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
Gemini: all requests fail due to anyOf schema in github_create_pull_request_review tool #14509
When using Gemini as the AI provider in OpenCode, every request fails with the following error:
Unable to submit request because `github_create_pull_request_review` functionDeclaration
`parameters.comments` schema specified other fields alongside any_of.
When using any_of, it must be the only field set.
Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling
Root Cause
Gemini API validates all tool schemas before processing any request.
The github_create_pull_request_review tool from @modelcontextprotocol/server-github
defines the comments parameter with anyOf combined with other fields (e.g. type, description, items).
Gemini strictly requires that when anyOf is used, it must be the only field in the schema object. No sibling fields allowed.
Impact
ANY request to Gemini fails — not just GitHub-related ones
The error appears even for simple questions like "hello"
Makes Gemini completely unusable when the GitHub MCP server is enabled
Workaround
Disable the GitHub MCP server in opencode.json:
"github": {
"enabled": false
}
Expected Fix
OpenCode should sanitize tool schemas before sending them to Gemini. When a schema uses anyOf, strip all sibling fields:
// Before (breaks Gemini):{type: 'array',anyOf: [...],description: '...'}// After (Gemini-compatible):{ anyOf: [...]}
If your issue is distinct from the above (e.g. specifically about sibling fields alongside anyOf rather than anyOf/const flattening), please clarify the difference so this can be tracked separately.
Same issue affects built-in edit tool — not MCP-specific
I'm encountering the identical error with OpenCode's built-in edit tool, not an MCP tool:
Error: Bad Request: {"error": {
"code": 400,
"message": "Unable to submit request because edit functionDeclaration parameters.edits schema specified other fields alongside any_of. When using any_of, it must be the only field set.",
"status": "INVALID_ARGUMENT"
}
}
This makes all Google/Gemini models completely unusable via the Antigravity auth plugin, since the edit tool is registered for every session.
This confirms the issue isn't limited to MCP tools — it also affects core built-in tools. The schema sanitization fix would need to handle all tools, not just MCP-sourced ones.
Disabling MCP servers does not fix this. The failing tool is OpenCode's own built-in edit tool (function_declarations[5]), not a GitHub or any other MCP tool.
Error
GenerateContentRequest.tools[0].function_declarations[5].parameters.properties[edits].items.properties: only allowed for OBJECT type
GenerateContentRequest.tools[0].function_declarations[5].parameters.properties[edits].items.required: only allowed for OBJECT type
Root cause
The edit tool's edits parameter is an array whose items define properties and required fields, but without type: "object". Gemini's API strictly requires type: "object" to be set before allowing properties/required on any schema node.
Since Gemini validates all tool schemas upfront, this causes every request to fail — including simple "hello" messages.
Fix needed
The Gemini schema sanitizer needs to handle array items — when items contain properties/required, add type: "object" if missing. PRs #13666 and #12911 are on the right track but need to cover the items case as well.
I have same issue. Is there a solution? I'm using gemini as my main model.
Bad Request: [{
"error": {
"code": 400,
"message": "Unable to submit request because `edit` functionDeclaration `parameters.edits` schema specified other fields alongside any_of. When using any_of, it must be the only field set. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling",
"errors": [
{
"message": "Unable to submit request because `edit` functionDeclaration `parameters.edits` schema specified other fields alongside any_of. When using any_of, it must be the only field set. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
]
I have same issue. Is there a solution? I'm using gemini as my main model.
Bad Request: [{
"error": {
"code": 400,
"message": "Unable to submit request because `edit` functionDeclaration `parameters.edits` schema specified other fields alongside any_of. When using any_of, it must be the only field set. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling",
"errors": [
{
"message": "Unable to submit request because `edit` functionDeclaration `parameters.edits` schema specified other fields alongside any_of. When using any_of, it must be the only field set. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
]
Activity
github-actions commentedon Feb 21, 2026
This issue might be a duplicate of existing issues. Please check:
sanitizeGeminidoesn't handleanyOf/constpatterns in MCP tool schemas — very similar root cause (Gemini rejecting tool schemas withanyOfpatterns), though targeting a slightly different schema patternsanitizeGeminiIf your issue is distinct from the above (e.g. specifically about sibling fields alongside
anyOfrather thananyOf/constflattening), please clarify the difference so this can be tracked separately.kuyavinny commentedon Feb 22, 2026
Same issue affects built-in
edittool — not MCP-specificI'm encountering the identical error with OpenCode's built-in
edittool, not an MCP tool:This makes all Google/Gemini models completely unusable via the Antigravity auth plugin, since the
edittool is registered for every session.This confirms the issue isn't limited to MCP tools — it also affects core built-in tools. The schema sanitization fix would need to handle all tools, not just MCP-sourced ones.
fix(provider): strip sibling fields for Gemini anyOf/oneOf schemas
OmerFarukOruc commentedon Feb 22, 2026
Additional findings: built-in
edittool schema causes failure, not MCP toolsDisabling MCP servers does not fix this. The failing tool is OpenCode's own built-in
edittool (function_declarations[5]), not a GitHub or any other MCP tool.Error
Root cause
The
edittool'seditsparameter is an array whose items definepropertiesandrequiredfields, but withouttype: "object". Gemini's API strictly requirestype: "object"to be set before allowingproperties/requiredon any schema node.Since Gemini validates all tool schemas upfront, this causes every request to fail — including simple "hello" messages.
Fix needed
The Gemini schema sanitizer needs to handle array
items— when items containproperties/required, addtype: "object"if missing. PRs #13666 and #12911 are on the right track but need to cover theitemscase as well.shyuuuuni commentedon Feb 23, 2026
I have same issue. Is there a solution? I'm using gemini as my main model.
RovshanMuradov commentedon Feb 23, 2026
set this plugin with that pr and it will fix, until then we have to wait when Dax fixes it jenslys/opencode-gemini-auth#58
kuyavinny commentedon Feb 24, 2026
I have PR #14659. It worked for me, but it needs more testing. It strips all sibling fields before submitting to the AI.
github-actions commentedon Apr 26, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.