ZodError- code 400

Open 💬 9 comments Opened Dec 8, 2025 by aohan237
💡 Likely answer: A maintainer (etraut-openai, contributor) responded on this thread — see the highlighted reply below.

What version of Codex is running?

0.65.0

What subscription do you have?

none

Which model were you using?

_No response_

What platform is your computer?

_No response_

What issue are you seeing?

{"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\n "error": {\n "message": "Invalid 'input[4].name':
empty string. Expected a string with minimum length 1, but got an empty string instead.",\n "type": "invalid_request_error",\n
"param": "input[4].name",\n "code": "empty_string"\n }\n}","provider_name":"OpenAI"}},"user_id":"user_2tzAauPJwyaDXmN7U69brwMHmBo"}

this should be addressed, for you ,maybe fast is not the best option, but quality does

What steps can reproduce the bug?

just use openrouter as your provider.

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

9 Comments

etraut-openai contributor · 7 months ago

Can you provide more details about your config settings?

Are you using the "chat" wire_api? We recommend using the newer "responses" wire_api. You can specify this through wire_api = "responses".

We have fixed a few recent regressions with the "chat" wire_api in the most recent prerelease (0.66.0-alpha.10) if you want to try that out.

aohan237 · 7 months ago

yes,using the "chat" wire_api

openrouter only support the chat completion api.

for now, i use version 0.59.0

i will try it out

aohan237 · 7 months ago

0.66.0-alpha.10 is fine.

aohan237 · 7 months ago

@etraut-openai after a upgrade codex cli

use OpenAI Codex (v0.73.0)

openrouter wire response api

■ {"success":false,"error":{"name":"ZodError","message":"[\n  {\n    \"code\": \"invalid_union\",\n    \"errors\": [],\n    \"note\": \"No
matching discriminator\",\n    \"discriminator\": \"type\",\n    \"path\": [\n      \"tools\",\n      5,\n      \"type\"\n    ],\n
\"message\": \"Invalid input\"\n  }\n]"}}

openrouter wire chat api

■ {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\n  \"error\": {\n    \"message\": \"Invalid schema for function
'shell_command': In context=(), 'additionalProperties' is required to be supplied and to be false.\",\n    \"type\": \"invalid_request_error\",\n
\"param\": \"tools[0].parameters\",\n    \"code\":
\"invalid_function_parameters\"\n  }\n}","provider_name":"OpenAI"}},"user_id":"user_2tzAauPJwyaDXmN7U69brwMHmBo"}
aohan237 · 6 months ago

@etraut-openai no one cares about this? it should be a common issue?

for now , i can use google' antigravity

etraut-openai contributor · 6 months ago

@aohan237, we've announced that we're discontinuing support for the old "chat" wire API at the end of this month. Please update to the "responses" API.

aohan237 · 6 months ago
@aohan237, we've announced that we're discontinuing support for the old "chat" wire API at the end of this month. Please update to the "responses" API.

Just read my new error log pls

Wire response api

Still report Zod error

smile7up · 5 months ago

I've also encountered the same issue. Currently using version 0.89.0, with openrouter as a proxy, this error occurs regardless of which wire_api is used, which is strange. Has anyone else encountered this issue? Or is there a related solution?

my config.toml:
model_provider = "openrouter"
model = "gpt-5.2-codex"
model_reasoning_effort = "high"
disable_response_storage = true

[model_providers.openrouter]
name = "openrouter"
base_url = "https://openrouter.ai/api/v1"
wire_api = "responses"
requires_openai_auth = true

Shawdox · 5 months ago
I've also encountered the same issue. Currently using version 0.89.0, with openrouter as a proxy, this error occurs regardless of which wire_api is used, which is strange. Has anyone else encountered this issue? Or is there a related solution? my config.toml: model_provider = "openrouter" model = "gpt-5.2-codex" model_reasoning_effort = "high" disable_response_storage = true [model_providers.openrouter] name = "openrouter" base_url = "https://openrouter.ai/api/v1" wire_api = "responses" requires_openai_auth = true

Do not use GPT-5.2-related models,it works fine for me on GPT-5. @aohan237 @smile7up @etraut-openai

GPT-5:

I’m your AI assistant. I can answer questions, help write/debug code, and run terminal commands in this
  project. I can also use available Codex skills (skill-creator, skill-
  installer) if you want. How can I help?

GPT-5.2:

■ {"success":false,"error":{"name":"ZodError","message":"[\n  {\n    \"code\": \"invalid_union\",\n
\"errors\": [],\n    \"note\": \"No matching discriminator\",\n    \"discriminator\": \"type\",\n
\"path\": [\n      \"tools\",\n      5,\n      \"type\"\n    ],\n    \"message\": \"Invalid
input\"\n  }\n]"}}

GPT-5.2-codex:

■ {"success":false,"error":{"name":"ZodError","message":"[\n  {\n    \"code\": \"invalid_union\",\n
\"errors\": [],\n    \"note\": \"No matching discriminator\",\n    \"discriminator\": \"type\",\n
\"path\": [\n      \"tools\",\n      5,\n      \"type\"\n    ],\n    \"message\": \"Invalid
input\"\n  }\n]"}}

<img width="1832" height="1182" alt="Image" src="https://github.com/user-attachments/assets/9318336b-2ecb-4f13-9e79-3776fe7dfd48" />