Invalid schema for function - Codex error
Quick fix
Upgrade cc-switch for the tool schema conversion fix. If upstream rejects oneOf strictly, use a historical task or switch model for now.
Symptom
Section titled “Symptom”Invalid schema for function 'codex_app__automation_update': schema must be a JSON Schema of 'type: "object"', got 'type: null'.The JSON Schema of built-in desktop tools injected by Codex and Claude Code (codex_app__automation_update, for example) is missing `"type": "object"` at the root level, or uses oneOf. When cc-switch converts the Responses format into OpenAI Chat Completions and forwards it to a third-party provider such as DeepSeek or Databricks, the upstream API validates the JSON Schema strictly and returns HTTP 400.
Early cc-switch versions did not handle the type: null case. Later versions (after PR #4706 landed) normalise it to {"type": "object", "properties": {}}, but still keep a top-level oneOf when handling a complex schema — so upstreams that validate extremely strictly, such as OpenAI models hosted on Databricks, still reject the request.
Upgrade cc-switch to the latest version (at minimum one containing PR #4706) to fix the 400 from type: null on upstreams such as DeepSeek.
On an upstream that strictly rejects a top-level oneOf, such as Databricks, keep using a historical task for now (the deferred namespace mechanism avoids exposing that tool directly), or switch to a model provider that validates schemas less strictly.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 4 real issues
- #3847Anthropic-OpenAI tool parameter schema: type becomes null
- #4705Codex Desktop使用DeepSeek provider,自动调用codex_app__automation_update 时出现 parameters schema type:null 导致 HTTP 400
- #4834cause: Invalid schema for function 'codex_app__automation_update': schema must be a JSON Schema of 'type: "object"', got 'type: null'.
- #6101[Bug] Databricks GPT-5.6: fresh Codex task fails when automation_update is flattened into Chat tools
- Why does connecting to the official API directly work while going through the cc-switch proxy errors?
- The official API validates tool schemas loosely, while cc-switch converts the request into OpenAI Chat Completions and forwards it to a third party such as DeepSeek, which validates the JSON Schema strictly.
- It still reports a oneOf error after upgrading cc-switch. What now?
- Some upstreams such as Databricks reject a schema containing a top-level oneOf. Until cc-switch flattens the schema fully, try using a historical task to trigger the deferred namespace mechanism, or switch to an upstream model that validates less strictly.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.