You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Numeric enum values not stringified for Gemini API #12784
When using Gemini models (gemini-3-pro-preview, gemini-2.5-flash, etc.), OpenCode sends numeric enum values in tool schemas as numbers instead of strings, causing 400 Bad Request errors from the Gemini API.
Error Message
Invalid value at 'tools[0].function_declarations[59].parameters.properties[1].value.enum[0]' (TYPE_STRING), 1
Invalid value at 'tools[0].function_declarations[59].parameters.properties[1].value.enum[1]' (TYPE_STRING), 2
Invalid value at 'tools[0].function_declarations[59].parameters.properties[1].value.enum[2]' (TYPE_STRING), 3
...
Root Cause
Gemini API requires all enum values to be strings. When OpenCode has numeric enum values like [0, 1, 2, 3, 4], they must be converted to ["0", "1", "2", "3", "4"] before sending to Gemini.
These issues all involve Gemini API's strict schema validation requirements. Your numeric enum issue may be part of a broader pattern of Gemini schema serialization problems.
Feel free to ignore if your specific case differs from these.
Activity
github-actions commentedon Feb 9, 2026
This issue might be a duplicate of existing issues. Please check:
These issues all involve Gemini API's strict schema validation requirements. Your numeric enum issue may be part of a broader pattern of Gemini schema serialization problems.
Feel free to ignore if your specific case differs from these.
fix(provider): fix property order bug in Gemini numeric enum stringif…
rekram1-node commentedon Feb 9, 2026
are u sure they should be converted to strings? What tool are u using that can handle that? Why not just drop enum and send it as a number field?
github-actions commentedon Apr 11, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
fix(llm-proxy): sanitize non-string enums in Gemini tool schemas (arc…