Skip to content

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.

Error output
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.

  1. 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.

  2. 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.

ToolCodex / Claude Code
Version3.14.3 - 3.19.1
PlatformsWindowsmacOS
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.

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.