OpenAI API · sdk · fg-0145
zodTextFormat with Zod 4 fails: schema must be a JSON Schema of type object, got type string
Invalid schema for response_format: schema must be a JSON Schema of 'type: "object"', got 'type: "string"'.
Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100
Cause
Before 6.7.0 the SDK converted schemas with a library that only understood Zod 3, so Zod 4 objects turned into a wrong schema.
Fix
Upgrade openai to 6.7.0 or later, or pin zod to version 3.
Apply
npm install openai@^6.7.0
Affects: openai-node earlier than 6.7.0 with zod 4; fixed in 6.7.0, 2025-10-24
Sources
Have your agent know this before it fails
claude mcp add --transport http footgun https://getfootgun.com/api/mcp