OpenAI Agents SDK errors / Schema
openai.BadRequestError: 400 'default' is not permitted
Cause
The SDK converts a Pydantic output_type to JSON Schema for response_format, but the OpenAI API forbids 'default' keywords and 'oneOf' constructs that Pydantic generates for defaulted fields or discriminated unions.
Fix
Remove default values from fields in your output_type model, or make them Optional[T] set explicitly in the prompt. For unions, flatten the schema manually rather than using Discriminator. Track the upstream sanitisation fix in SDK issue #474.
Part of the Automation Error Index — OpenAI Agents SDK errors: browse all.
Hitting an automation error we have not covered?
AutomateLab builds and debugs n8n, Make, and agent workflows as fixed-scope projects. If something is broken in production, tell us what you are seeing.
Describe the problem