You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Streamable MCP run normally and return results, but soon get unexpected status 400 Bad Request error #6540
MCP can run normally and return results, but soon messages like
Reconnecting... 1/5, Reconnecting... 2/5, Reconnecting... 3/5, Reconnecting... 4/5, Reconnecting... 5/5
appear, followed by the following error:
unexpected status 400 Bad Request: {
"error": {
"message": "Invalid 'input[3].name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'.",
"type": "invalid_request_error",
"param": "input[3].name",
"code": "invalid_value"
}
}
■ unexpected status 400 Bad Request: { "error": { "message": "Invalid 'input[4].name': string does not match pattern. Expected a string that matches the pattern '^[a- zA-Z0-9_-]+$'.", "type": "invalid_request_error", "param": "input[4].name", "code": "invalid_value" } }
I was able to reproduce this on a VPS with a recorded session whose transcript contains tool calls with names that include '.' (e.g. functions.exec_command, legacy container.exec). When Codex sends that history back to the OpenAI Responses API, the request fails with a 400:
'Invalid 'input[N].name': string does not match pattern '^[a-zA-Z0-9_-]+$'
I opened PR #9447 to address this by normalizing tool call names in the transcript before sending request history (and in compaction payloads too):
container.exec -> shell
strip namespace prefixes like functions. when the suffix matches a known tool
otherwise sanitize invalid chars to '_'
Includes unit tests + manual verification via resuming the failing session (no more input[*].name validation error).
I'm also getting a similar error, I don't know why it's happening, but it has something to do with tool/mcp:
{
"error": {
"message": "Invalid 'input[25].name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'.",
"type": "invalid_request_error",
"param": "input[25].name",
"code": "invalid_value"
}
}
what should I do? I see that the PR #9447 was closed.
An observation from a recovered Codex Desktop session may help narrow this down, although it is not a universal fix.
In our case, a conversation stopped working after a model/provider switch. Its persisted history contained three function_call.name values with ::. The endpoint allowed dots but rejected colons, unlike the pattern in this issue. One invalid name was still present in the post-compaction history. A comparison conversation with the same switch direction had valid names and continued normally, so switching models alone was not enough to cause the failure.
For this specific session, after preserving a complete backup and preventing concurrent writes, we repaired only those three name fields using a verified equal-length replacement (six bytes total). All other bytes, arguments, call IDs, original failed tool outputs and byte-based history cutoffs were preserved. The history parsed afterward, and the operator confirmed the conversation could continue. We did not capture the raw outgoing request, so we cannot prove which saved item became input[N] or assign sole responsibility to the model, client or gateway. This is not evidence that replacing :: with __ is a valid mapping for other tools or versions.
Before attempting a repair, check the actual saved or outgoing function_call.name against the exact pattern in your error. The request index is not necessarily a session-file line number. If no invalid name is found, this workaround does not apply. Preserve the original history and use only an unambiguous, verified tool-name mapping; do not globally replace punctuation, strip all namespaces or delete tool outputs. Repairs that change file length can also break byte-based history offsets in some versions. A running client may still hold the old history in memory.
PR #9447 was closed without being merged, and the maintainers explicitly declined it as the correct fix. It should not be treated as a released upstream solution.
If you can share the offending name, exact error pattern and client version in a minimal redacted example—not a full session or credentials—that would help determine whether this is the same history-validation mechanism or a different MCP/namespace problem.
Activity
zxzxzxzzy0119 commentedon Nov 18, 2025
0.58.0 also have this problem, error info:
■ unexpected status 400 Bad Request: { "error": { "message": "Invalid 'input[4].name': string does not match pattern. Expected a string that matches the pattern '^[a- zA-Z0-9_-]+$'.", "type": "invalid_request_error", "param": "input[4].name", "code": "invalid_value" } }
illanes00 commentedon Jan 18, 2026
I was able to reproduce this on a VPS with a recorded session whose transcript contains tool calls with names that include '.' (e.g.
functions.exec_command, legacycontainer.exec). When Codex sends that history back to the OpenAI Responses API, the request fails with a 400:'Invalid 'input[N].name': string does not match pattern '^[a-zA-Z0-9_-]+$'
I opened PR #9447 to address this by normalizing tool call names in the transcript before sending request history (and in compaction payloads too):
container.exec->shellfunctions.when the suffix matches a known toolIncludes unit tests + manual verification via resuming the failing session (no more
input[*].namevalidation error).yoavram commentedon Jan 28, 2026
I'm also getting a similar error, I don't know why it's happening, but it has something to do with tool/mcp:
{
"error": {
"message": "Invalid 'input[25].name': string does not match pattern. Expected a string that matches the pattern '^[a-zA-Z0-9_-]+$'.",
"type": "invalid_request_error",
"param": "input[25].name",
"code": "invalid_value"
}
}
what should I do? I see that the PR #9447 was closed.
What version of Codex is running?
codex-cli 0.91.0
What subscription do you have?
OpenAI Edu
Which model were you using?
gpt-5.2-codex Medium
What platform is your computer?
MacOS 26.2 (25C56) Apple M4 Pro
Additional information
MCP servers
tooluniverse 1.0.16
Zotero MCP v0.1.2
RongNianXin commentedon Oct 13, 2026
An observation from a recovered Codex Desktop session may help narrow this down, although it is not a universal fix.
In our case, a conversation stopped working after a model/provider switch. Its persisted history contained three
function_call.namevalues with::. The endpoint allowed dots but rejected colons, unlike the pattern in this issue. One invalid name was still present in the post-compaction history. A comparison conversation with the same switch direction had valid names and continued normally, so switching models alone was not enough to cause the failure.For this specific session, after preserving a complete backup and preventing concurrent writes, we repaired only those three name fields using a verified equal-length replacement (six bytes total). All other bytes, arguments, call IDs, original failed tool outputs and byte-based history cutoffs were preserved. The history parsed afterward, and the operator confirmed the conversation could continue. We did not capture the raw outgoing request, so we cannot prove which saved item became
input[N]or assign sole responsibility to the model, client or gateway. This is not evidence that replacing::with__is a valid mapping for other tools or versions.Before attempting a repair, check the actual saved or outgoing
function_call.nameagainst the exact pattern in your error. The request index is not necessarily a session-file line number. If no invalid name is found, this workaround does not apply. Preserve the original history and use only an unambiguous, verified tool-name mapping; do not globally replace punctuation, strip all namespaces or delete tool outputs. Repairs that change file length can also break byte-based history offsets in some versions. A running client may still hold the old history in memory.PR #9447 was closed without being merged, and the maintainers explicitly declined it as the correct fix. It should not be treated as a released upstream solution.
If you can share the offending name, exact error pattern and client version in a minimal redacted example—not a full session or credentials—that would help determine whether this is the same history-validation mechanism or a different MCP/namespace problem.