Tool schemas cause 400 errors on strict validators (Codex, Vertex AI) #9401

Open
opened 2026-02-16 18:12:21 -05:00 by yindo · 1 comment
Owner

Originally created by @sametakofficial on GitHub (Feb 15, 2026).

Originally assigned to: @thdxr on GitHub.

Built-in tool schemas (like question) break on providers with strict JSON Schema validation — Codex, Vertex AI OpenAI-compatible, SGLang, etc.

The question tool has two problems:

  • additionalProperties: false is set but multiple isn't in required, which strict validators reject
  • Zod .meta() injects $schema and ref keywords that aren't valid in OpenAI function parameter schemas

Error from Codex:

Invalid schema for function 'question': In context=('properties', 'questions',
'items'), 'required' is required to be supplied and to be an array including
every key in properties. Missing 'multiple'.

Related: #11413, #8184

Originally created by @sametakofficial on GitHub (Feb 15, 2026). Originally assigned to: @thdxr on GitHub. Built-in tool schemas (like `question`) break on providers with strict JSON Schema validation — Codex, Vertex AI OpenAI-compatible, SGLang, etc. The `question` tool has two problems: - `additionalProperties: false` is set but `multiple` isn't in `required`, which strict validators reject - Zod `.meta()` injects `$schema` and `ref` keywords that aren't valid in OpenAI function parameter schemas Error from Codex: ``` Invalid schema for function 'question': In context=('properties', 'questions', 'items'), 'required' is required to be supplied and to be an array including every key in properties. Missing 'multiple'. ``` Related: #11413, #8184
Author
Owner

@github-actions[bot] commented on GitHub (Feb 15, 2026):

This issue appears to be closely related to several existing issues addressing the same root cause - missing 'required' field in tool schemas and invalid Zod meta fields:

  • #13618: Claude API rejects tool schemas with missing 'required' field
  • #11413: The specific 'question' tool schema issue on Vertex AI/Gemini
  • #8184: SGLang strict validation failures with empty object parameters

All of these stem from the same problem in the schema transformation layer where object-based schemas don't include an explicit 'required' field and Zod's `` metadata isn't being stripped. Consider consolidating these issues or using one as the canonical issue for the fix across all providers.

@github-actions[bot] commented on GitHub (Feb 15, 2026): This issue appears to be closely related to several existing issues addressing the same root cause - missing 'required' field in tool schemas and invalid Zod meta fields: - #13618: Claude API rejects tool schemas with missing 'required' field - #11413: The specific 'question' tool schema issue on Vertex AI/Gemini - #8184: SGLang strict validation failures with empty object parameters All of these stem from the same problem in the schema transformation layer where object-based schemas don't include an explicit 'required' field and Zod's `` metadata isn't being stripped. Consider consolidating these issues or using one as the canonical issue for the fix across all providers.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9401