ZodError / Schema Validation Failure when using GPT-5.2 series via OpenRouter

Resolved 💬 1 comment Opened Jan 25, 2026 by Shawdox Closed Jan 25, 2026

What version of Codex is running?

codex-cli 0.90.0

What subscription do you have?

Standard OpenRouter account with credits

Which model were you using?

GPT-5, GPT-5.2, GPT-5.2-codex

What platform is your computer?

Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64

What terminal emulator and version are you using (if applicable)?

zsh

What issue are you seeing?

The application crashes when switching to GPT-5.2 series models (specifically gpt-5.2-codex and gpt-5.2) but works fine with GPT-5 provided via OpenRouter. The system fails to validate the response payload, resulting in a ZodError.

What steps can reproduce the bug?

Profile file ~/.codex/config.toml:

model_provider="openrouter"
model_reasoning_effort = "medium"
trust_level="trusted"

[model_providers.openrouter]
name="OpenRouter"
base_url="https://openrouter.ai/api/v1"
env_key="OPENROUTER_API_KEY"
wire_api = "responses"
[profiles.openrouter_gpt]
model_provider = "openrouter"
model_reasoning_effort = "medium"
model = "openai/gpt-5"

Run:

codex --profile openrouter_gpt

What is the expected behavior?

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]"}}

Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗