Summary
All agents using the Gemini provider fail with INVALID_ARGUMENT errors because the propertyNames JSON Schema keyword is not stripped from tool schemas before API calls.
Error
API error (400): INVALID_ARGUMENT: Invalid JSON payload received.
Unknown name "propertyNames" at 'tools[0].function_declarations[214].parameters.properties[14].value.properties[0].value': Cannot find field.
Root Cause
The normalize_schema_recursive function in crates/openfang-types/src/tool.rs (lines 84-97) strips unsupported JSON Schema fields for non-Anthropic providers:
if matches!(
key.as_str(),
"$schema"
| "$defs"
| "$ref"
| "additionalProperties"
| "default"
| "$id"
| "$comment"
| "examples"
| "title"
| "const"
| "format"
) {
continue;
}
"propertyNames" is missing from this list. The Gemini API does not support this JSON Schema keyword, so any tool schema containing propertyNames causes the entire request to be rejected.
Impact
- Severity: Critical — affects all agents using the Gemini provider
- Agents enter a crash → recovery → re-crash loop
- Agents hang for 300+ seconds before auto-recovery kicks in
- Effectively makes the service unavailable when Gemini is the primary model
Proposed Fix
Add "propertyNames" to the matches! block:
if matches!(
key.as_str(),
"$schema"
| "$defs"
| "$ref"
| "additionalProperties"
| "default"
| "$id"
| "$comment"
| "examples"
| "title"
| "const"
| "propertyNames"
| "format"
) {
continue;
}
This is a one-line addition. The propertyNames keyword is a standard JSON Schema keyword that constrains property name patterns, but is not supported by the Gemini Function Calling API.
Workaround
Switch agents to a provider that accepts full JSON Schema (e.g., anthropic, openrouter), or route through OpenRouter with google/gemini-2.5-pro-preview-03-25 which handles schema normalization on their side.
Environment
- OpenFang version: 0.5.5
- Provider: Gemini (native driver)
- Affected: All tool-bearing agents
Summary
All agents using the Gemini provider fail with
INVALID_ARGUMENTerrors because thepropertyNamesJSON Schema keyword is not stripped from tool schemas before API calls.Error
Root Cause
The
normalize_schema_recursivefunction incrates/openfang-types/src/tool.rs(lines 84-97) strips unsupported JSON Schema fields for non-Anthropic providers:"propertyNames"is missing from this list. The Gemini API does not support this JSON Schema keyword, so any tool schema containingpropertyNamescauses the entire request to be rejected.Impact
Proposed Fix
Add
"propertyNames"to thematches!block:This is a one-line addition. The
propertyNameskeyword is a standard JSON Schema keyword that constrains property name patterns, but is not supported by the Gemini Function Calling API.Workaround
Switch agents to a provider that accepts full JSON Schema (e.g.,
anthropic,openrouter), or route through OpenRouter withgoogle/gemini-2.5-pro-preview-03-25which handles schema normalization on their side.Environment