Repository navigation
Closed as not planned
Labels
CLIIssues related to the Codex CLIbugSomething isn't workingcustom-modelIssues related to custom model providers (including local models)
Description
What version of Codex CLI is running?
codex-cli 0.121.0
What subscription do you have?
Plus
Which model were you using?
No response
What platform is your computer?
macos
What terminal emulator and version are you using (if applicable)?
Iterm2
What issue are you seeing?
{"error":{"code":"invalid_prompt","message":"Invalid Responses API request"},"metadata":{"raw":"[\n {\n \"code\": \"invalid_union\",\n \"errors\":
[\n [\n {\n \"code\": \"invalid_union\",\n \"errors\": [],\n \"note\": \"No matching discriminator\",\n
\"discriminator\": \"type\",\n \"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input\"\n }\n ],\n
[\n {\n \"code\": \"invalid_value\",\n \"values\": [\n \"openrouter:datetime\"\n ],\n \"path\": [\n
\"type\"\n ],\n \"message\": \"Invalid input: expected \\\"openrouter:datetime\\\"\"\n }\n ],\n [\n {\n
\"code\": \"invalid_value\",\n \"values\": [\n \"openrouter:image_generation\"\n ],\n \"path\": [\n
\"type\"\n ],\n \"message\": \"Invalid input: expected \\\"openrouter:image_generation\\\"\"\n }\n ],\n [\n {\n
\"code\": \"invalid_value\",\n \"values\": [\n \"openrouter:experimental__search_models\"\n ],\n \"path\": [\n
\"type\"\n ],\n \"message\": \"Invalid input: expected \\\"openrouter:experimental__search_models\\\"\"\n }\n ],\n [\n
{\n \"code\": \"invalid_value\",\n \"values\": [\n \"openrouter:web_search\"\n ],\n \"path\": [\n
\"type\"\n ],\n \"message\": \"Invalid input: expected \\\"openrouter:web_search\\\"\"\n }\n ]\n ],\n \"path\": [\n
\"tools\",\n 16\n ],\n \"message\": \"Invalid input\"\n },\n {\n \"code\": \"invalid_union\",\n \"errors\": [\n [\n {\n
\"code\": \"invalid_union\",\n \"errors\": [],\n \"note\": \"No matching discriminator\",\n \"discriminator\": \"type\",\n
\"path\": [\n \"type\"\n ],\n \"message\": \"Invalid input\"\n }\n ],\n [\n {\n \"code\":
\"invalid_value\",\n \"values\": [\n \"openrouter:datetime\"\n ],\n \"path\": [\n \"type\"\n ],\n
\"message\": \"Invalid input: expected \\\"openrouter:datetime\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n
\"values\": [\n \"openrouter:image_generation\"\n ],\n \"path\": [\n \"type\"\n ],\n \"message\":
\"Invalid input: expected \\\"openrouter:image_generation\\\"\"\n }\n ],\n [\n {\n \"code\": \"invalid_value\",\n
\"values\": [\n \"openrouter:experimental__search_models\"\n ],\n \"path\": [\n \"type\"\n ],\n
\"message\": \"Invalid input: expected \\\"openrouter:experimental__search_models\\\"\"\n }\n ],\n [\n {\n \"code\":
\"invalid_value\",\n \"values\": [\n \"openrouter:web_search\"\n ],\n \"path\": [\n \"type\"\n ],\n
\"message\": \"Invalid input: expected \\\"openrouter:web_search\\\"\"\n }\n ]\n ],\n \"path\": [\n \"tools\",\n 17\n ],\n
\"message\": \"Invalid input\"\n }\n]"}}
What steps can reproduce the bug?
I use OpenRouter for models. Just upgraded to latest codex cli version and started to receive this message on any prompt
What is the expected behavior?
No response
Additional information
here is the same error: #12114
Metadata
Metadata
Assignees
Labels
CLIIssues related to the Codex CLIbugSomething isn't workingcustom-modelIssues related to custom model providers (including local models)
Activity
github-actions commentedon Apr 17, 2026
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
etraut-openai commentedon Apr 17, 2026
Please report the bug to the openrouter maintainers.
papirosko commentedon Apr 17, 2026
quick fix:
comment all sections, starting with
[mcp_servers.in~/.codex/config.tomltt-a1i commentedon Apr 17, 2026
Hit by this today too, here's a dump of what I dug up in case it helps others searching for this.
Narrowing the source. The failing
tools[N]indices drop by exactly one when you disable the auto-enabledcomputer-use@openai-bundledplugin:tools[17],[18],[19]rejectedtools[17],[18]still rejectedSo there are at least two independent sources of the unknown tool type. One is computer-use (expected — OpenRouter's Responses API zod schema doesn't know OpenAI's computer-use tool). The other two come from core Codex 0.121.0, most likely the MCP Apps tool support from #17364 —
apps = trueis a stable default now and that's a new tool-injection path. @papirosko's workaround of commenting out[mcp_servers.*]sections is consistent with this — it strips the MCP-originated tool entries from the array.Everything it emits has a
typethat's neitherfunctionnor any of the fouropenrouter:*variants, so the discriminated union throws them out.Notes for Codex.app (desktop) users, since that's what I started with before moving to the CLI:
codexbinary under/Applications/Codex.app/Contents/Resources/codex, independent ofnpm -g @openai/codex. Downgrading via npm only fixes the CLI — the app is unaffected.~/.codex/config.tomlwhile the app is running does nothing. The app only reads config at startup, and closing the window isn't enough — you have to ⌘Q the whole app for plugin toggles to take effect.[marketplaces.openai-bundled] last_updatedbumped to2026-04-17T07:14:26Zin my config), thecomputer-use@openai-bundledplugin got auto-enabled without prompting. Its MCP server (SkyComputerUseClient mcp) also stays resident in the background — I saw it persist across sessions even after flippingenabled = false, sopkill SkyComputerUseClientafter disabling is worth doing to be safe.resume/resume --lastcaches the prior session's tool list in the rollout, so even a config change + restart won't help if you re-enter via resume — start a fresh session.Workarounds that actually work today:
npm i -g @openai/[email protected]for the CLI (confirmed working).dmgfrom the releases page and reinstallcheck_for_update_on_startup = falsein~/.codex/config.tomlprevents auto-upgrade back to 0.121.0wire_api = "chat"on the openrouter provider block should sidestep this entirely (haven't tested myself, but chat completions has a much looser tool schema)[mcp_servers.*]) also works and is more surgical if you want to stay on 0.121.0The root-cause bucket here (new Codex tool types vs. OpenRouter's strict Responses schema) is different from the earlier rounds on #12114, which were about message/input shapes. The
toolsarray is the new surface.TylonHH commentedon Apr 18, 2026
Now I get
{"type":"error","status":400,"error":{"type":"invalid_request_error","message":"The 'MiniMax: MiniMax M2.5' model is not supported when using Codex with a ChatGPT account."}}Invoker-liu commentedon Apr 27, 2026
Down to 120,everything is fine