Gemini Function Call Schema Invalid (400 INVALID_ARGUMENT)
Your function declaration uses features Gemini's OpenAPI 3.0 subset doesn't support. Common triggers: anyOf/oneOf at wrong level, unsupported format values, missing types, or migrating an OpenAI schema without translation.
Gemini uses an OpenAPI 3.0 subset: types = string/integer/number/boolean/array/object, plus enum, nullable, required, description. Not supported: oneOf, allOf, $ref, most format values, string constraints. Use google.genai.types.Schema or plain dicts respecting the subset.
The Error Messages You're Seeing
HTTP/1.1 400 Bad Request
{
"error": {
"code": 400,
"message": "Invalid FunctionDeclaration: field 'parameters.
properties.email.format' has unsupported value 'email'.",
"status": "INVALID_ARGUMENT"
}
}
Variants:
"Unknown field 'oneOf' in Schema"
"Field 'parameters' missing required 'type'"
"Unsupported schema type: 'null'"
"'additionalProperties' not supported in this context"
"Invalid enum value type: expected STRING"Supported vs Unsupported (OpenAPI Subset)
| Feature | Supported | Notes |
|---|---|---|
| type: string, integer, number, boolean, array, object | Yes | Core types |
| enum (on strings) | Yes | Great for constrained choices |
| nullable: true | Yes | Preferred over union types |
| description | Yes | Improves accuracy |
| required (array of prop names) | Yes | List required fields |
| propertyOrdering | Yes | Recommended for consistency |
| anyOf | Yes (limited) | Nested only, avoid at root |
| oneOf, allOf, $ref | No | Not supported |
| format: date-time, enum values on number | Partial | Only some formats work |
| format: email, uuid, uri | No | String constraints unsupported |
| minLength/maxLength/pattern | No | Not supported |
| additionalProperties | No | Silently ignored |
What Actually Causes This Error
type: "object" at parameters level.Fixes That Work (Tested Nov 2026)
1Correct Function Declaration
2OpenAI → Gemini Schema Translator
Gemini's schema types use UPPERCASE ("STRING", "OBJECT") when serialized to JSON, matching OpenAPI's Type enum. The SDK's types.Schema class accepts either — but raw dicts must use uppercase.
3Debug Common Failures
Preventing This Error Going Forward
- Use
types.Schemafor type-checked construction. - Uppercase types in raw dicts. STRING, OBJECT, INTEGER.
- Prefer
nullable: trueover union types. - Skip unsupported format values. email, uuid — validate client-side.
- Don't rely on
additionalProperties. Silently ignored. - Use
property_orderingfor consistent output shapes. - Translate OpenAI schemas via helper. Don't paste directly.
Researcher · AI Error Hub
Frequently Asked Questions
Yes — the SDK's from_callable or Pydantic-to-Schema helpers translate most of it. For complex models, verify the generated schema doesn't emit $ref, oneOf, or unsupported format values. Sanitize before use.
Yes — the model uses ordering as a hint for output field order. Especially useful for controlled generation with response_schema. Consistent ordering improves downstream parsing reliability.
Two ways. (1) Omit from required array — field may not appear. (2) Include in required with nullable: true — field always appears but may be null. Option 2 gives more consistent parsing.
Yes — the model may return multiple function_call parts in a single candidate. Iterate all parts and dispatch each. Configure via tool_config with mode ANY, AUTO, or NONE.
Gemini accepts a subset of OpenAPI 3.0 (which overlaps JSON Schema). Some full JSON Schema features ($ref, allOf, oneOf, complex format) don't work. Stick to the documented subset.
Related Errors
Master Gemini Function Calling
Weekly deep dives on function schemas, tool design, and multi-provider migration. 12,000+ developers subscribe.
Subscribe Free →