Gemini 3 models fail with "Invalid JSON payload received. Unknown name 'parameters'" error #6459

Closed
opened 2026-02-16 18:04:17 -05:00 by yindo · 7 comments
Owner

Originally created by @lvsao on GitHub (Jan 16, 2026).

Originally assigned to: @rekram1-node on GitHub.

OpenCode GitHub Issue Report

Issue Title

Gemini 3 models fail with "Invalid JSON payload received. Unknown name 'parameters'" error when using antigravity-auth plugin

Issue Description

When using google/antigravity-gemini-3-flash or google/antigravity-gemini-3-pro models, OpenCode fails with a 400 error due to invalid tool schema format for Gemini API.

Error Message

Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]': Cannot find field.
Status: 400
Requested Model: antigravity-gemini-3-flash
Effective Model: gemini-3-flash
Endpoint: https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:streamGenerateContent?alt=sse

Tool Debug Payload (Problematic)

The tool schema being sent to Gemini contains an incorrectly formatted structure:

[{
  "functionDeclarations": [...],
  "parameters": {
    "type": "OBJECT",
    "properties": {
      "_placeholder": {
        "type": "BOOLEAN",
        "description": "Placeholder. Always pass true."
      }
    },
    "required": ["_placeholder"]
  }
}]

Expected Behavior

Tool schemas should be formatted according to Gemini API specifications, with:

  1. Proper type: "object" (lowercase)
  2. No _placeholder parameters
  3. No unsupported JSON Schema fields like $schema
  4. String-only enum values

Environment

  • OpenCode Version: v1.1.23 (latest)
  • Plugin: opencode-antigravity-auth@1.2.8
  • OS: Windows
  • Model: google/antigravity-gemini-3-flash (all variants fail)
  • Project: J:\apps\max-Translator\max-ai-omni-translator

Related Issues

  • OpenCode #3140: "AI_APICallError: GenerateContentRequest.tools[0].function_declarations[32].parameters. required[0]: property is not defined"
  • OpenCode #4512: "sanitize tools for Gemini 3 compatibility" (fixed in PR #4538 but issue persists)
  • OpenCode #4665: "OpenCode plus Zen Gemini 3 Pro model causes errors"
  • Qwen Code #1186: "API Error 400 with Gemini model: Invalid JSON payload received. Unknown name '$schema'"

Reproduction Steps

  1. Install opencode-antigravity-auth@beta plugin
  2. Configure google/antigravity-gemini-3-flash model
  3. Run: opencode run "Hello" --model=google/antigravity-gemini-3-flash
  4. Observe 400 error with "Unknown name 'parameters'" message

Workaround

Claude models (antigravity-claude-sonnet-4-5-thinking) work correctly with the same configuration.

Suggested Fix

Implement proper tool schema sanitization for Gemini API:

  1. Remove $schema field from tool parameter schemas
  2. Convert non-string enum values to strings
  3. Ensure type field uses lowercase values
  4. Remove placeholder parameters like _placeholder
  5. Validate schema against Gemini's expected format

See OpenCode PR #4538 for previous attempts at fixing similar issues.

Originally created by @lvsao on GitHub (Jan 16, 2026). Originally assigned to: @rekram1-node on GitHub. # OpenCode GitHub Issue Report ## Issue Title Gemini 3 models fail with "Invalid JSON payload received. Unknown name 'parameters'" error when using antigravity-auth plugin ## Issue Description When using `google/antigravity-gemini-3-flash` or `google/antigravity-gemini-3-pro` models, OpenCode fails with a 400 error due to invalid tool schema format for Gemini API. ### Error Message ``` Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]': Cannot find field. Status: 400 Requested Model: antigravity-gemini-3-flash Effective Model: gemini-3-flash Endpoint: https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:streamGenerateContent?alt=sse ``` ### Tool Debug Payload (Problematic) The tool schema being sent to Gemini contains an incorrectly formatted structure: ```json [{ "functionDeclarations": [...], "parameters": { "type": "OBJECT", "properties": { "_placeholder": { "type": "BOOLEAN", "description": "Placeholder. Always pass true." } }, "required": ["_placeholder"] } }] ``` ## Expected Behavior Tool schemas should be formatted according to Gemini API specifications, with: 1. Proper `type: "object"` (lowercase) 2. No `_placeholder` parameters 3. No unsupported JSON Schema fields like `$schema` 4. String-only enum values ## Environment - **OpenCode Version**: v1.1.23 (latest) - **Plugin**: opencode-antigravity-auth@1.2.8 - **OS**: Windows - **Model**: google/antigravity-gemini-3-flash (all variants fail) - **Project**: J:\apps\max-Translator\max-ai-omni-translator ## Related Issues - OpenCode #3140: "AI_APICallError: GenerateContentRequest.tools[0].function_declarations[32].parameters. required[0]: property is not defined" - OpenCode #4512: "sanitize tools for Gemini 3 compatibility" (fixed in PR #4538 but issue persists) - OpenCode #4665: "OpenCode plus Zen Gemini 3 Pro model causes errors" - Qwen Code #1186: "API Error 400 with Gemini model: Invalid JSON payload received. Unknown name '$schema'" ## Reproduction Steps 1. Install opencode-antigravity-auth@beta plugin 2. Configure google/antigravity-gemini-3-flash model 3. Run: `opencode run "Hello" --model=google/antigravity-gemini-3-flash` 4. Observe 400 error with "Unknown name 'parameters'" message ## Workaround Claude models (antigravity-claude-sonnet-4-5-thinking) work correctly with the same configuration. ## Suggested Fix Implement proper tool schema sanitization for Gemini API: 1. Remove `$schema` field from tool parameter schemas 2. Convert non-string enum values to strings 3. Ensure `type` field uses lowercase values 4. Remove placeholder parameters like `_placeholder` 5. Validate schema against Gemini's expected format See OpenCode PR #4538 for previous attempts at fixing similar issues.
yindo closed this issue 2026-02-16 18:04:17 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 16, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #3140: AI_APICallError with Gemini API tool schema validation (similar 'parameters' and 'required' property issues)
  • #8036: Schema validation error with Google/Gemini models (enum values not being strings - same root cause)
  • #365: Google provider tool call schema mismatches with Gemini models (same error pattern with function_declarations)
  • #4512: sanitize tools for Gemini 3 compatibility (Gemini enum validation failures - related root cause)
  • #4665: OpenCode plus Zen Gemini 3 Pro model causes errors (Gemini tool schema validation - same issue pattern)
  • #2082: JSON schema validation errors affecting Gemini and other providers (related tool schema issue)

These issues all relate to tool schema formatting problems when interfacing with Gemini API. The root cause appears to be improper sanitization of tool schemas before sending to the Gemini API (missing required fields, incorrect enum types, unsupported fields like $schema, etc.).

Feel free to ignore if your specific case differs.

@github-actions[bot] commented on GitHub (Jan 16, 2026): This issue might be a duplicate of existing issues. Please check: - #3140: AI_APICallError with Gemini API tool schema validation (similar 'parameters' and 'required' property issues) - #8036: Schema validation error with Google/Gemini models (enum values not being strings - same root cause) - #365: Google provider tool call schema mismatches with Gemini models (same error pattern with function_declarations) - #4512: sanitize tools for Gemini 3 compatibility (Gemini enum validation failures - related root cause) - #4665: OpenCode plus Zen Gemini 3 Pro model causes errors (Gemini tool schema validation - same issue pattern) - #2082: JSON schema validation errors affecting Gemini and other providers (related tool schema issue) These issues all relate to tool schema formatting problems when interfacing with Gemini API. The root cause appears to be improper sanitization of tool schemas before sending to the Gemini API (missing required fields, incorrect enum types, unsupported fields like `$schema`, etc.). Feel free to ignore if your specific case differs.
Author
Owner

@rekram1-node commented on GitHub (Jan 16, 2026):

believe this is a bug in ur plugin

@rekram1-node commented on GitHub (Jan 16, 2026): believe this is a bug in ur plugin
Author
Owner

@noises1990 commented on GitHub (Jan 16, 2026):

I'm encountering the same issue

Using with github-copilot vendor:
Image

Using with google/antigravity

opencode run --model google/antigravity-gemini-3-pro-high "hi"
Error: Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]': Cannot find field.

[Debug Info]
Requested Model: antigravity-gemini-3-pro-high
Effective Model: gemini-3-pro-high
Project: ***********
Endpoint: https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:streamGenerateContent?alt=sse
Status: 400
Request ID: N/A
Tool Debug Missing: 1
Tool Debug Summary: idx=0, hasCustom=true, customSchema=true, hasFunction=false, functionSchema=false

@noises1990 commented on GitHub (Jan 16, 2026): I'm encountering the same issue Using with github-copilot vendor: <img width="535" height="107" alt="Image" src="https://github.com/user-attachments/assets/0b72682b-413b-425f-829a-2d6e68cb89c7" /> Using with google/antigravity opencode run --model google/antigravity-gemini-3-pro-high "hi" Error: Invalid JSON payload received. Unknown name "parameters" at 'request.tools[0]': Cannot find field. [Debug Info] Requested Model: antigravity-gemini-3-pro-high Effective Model: gemini-3-pro-high Project: *********** Endpoint: https://daily-cloudcode-pa.sandbox.googleapis.com/v1internal:streamGenerateContent?alt=sse Status: 400 Request ID: N/A Tool Debug Missing: 1 Tool Debug Summary: idx=0, hasCustom=true, customSchema=true, hasFunction=false, functionSchema=false
Author
Owner

@chindris-mihai-alexandru commented on GitHub (Jan 18, 2026):

I'm experiencing the same issue with thinking models. Created a related issue #9302 for the thinking model variant.

This appears to be a broader Antigravity plugin issue where Google's API is rejecting OpenCode's request format for both:

  • Tool parameters ("Unknown name 'parameters'")
  • Thinking model parameters ("Unknown name 'thinking'")

Workaround that works:

  • Non-thinking Antigravity models: google/antigravity-claude-sonnet-4-5
  • OpenRouter free models: openrouter/xiaomi/mimo-v2-flash:free

The issue seems to be recent - these were working before. Likely a change in Google's Antigravity API endpoint compatibility.

@chindris-mihai-alexandru commented on GitHub (Jan 18, 2026): I'm experiencing the same issue with thinking models. Created a related issue #9302 for the thinking model variant. This appears to be a broader Antigravity plugin issue where Google's API is rejecting OpenCode's request format for both: - Tool parameters ("Unknown name 'parameters'") - Thinking model parameters ("Unknown name 'thinking'") **Workaround that works:** - Non-thinking Antigravity models: `google/antigravity-claude-sonnet-4-5` - OpenRouter free models: `openrouter/xiaomi/mimo-v2-flash:free` The issue seems to be recent - these were working before. Likely a change in Google's Antigravity API endpoint compatibility.
Author
Owner

@rekram1-node commented on GitHub (Jan 18, 2026):

If you are dealing w/ antigravity issues please open issue in antigravity plugin repo, we don't support them first class

@rekram1-node commented on GitHub (Jan 18, 2026): If you are dealing w/ antigravity issues please open issue in antigravity plugin repo, we don't support them first class
Author
Owner

@rekram1-node commented on GitHub (Jan 18, 2026):

@noises1990 your issue is separate and related to copilot, believe it has been fixed tho (talked w/ copilot team)

@rekram1-node commented on GitHub (Jan 18, 2026): @noises1990 your issue is separate and related to copilot, believe it has been fixed tho (talked w/ copilot team)
Author
Owner

@chindris-mihai-alexandru commented on GitHub (Jan 18, 2026):

@noises1990

Copilot-related: Check if you have a custom github-copilot provider in opencode.json. If so, remove it entirely. OpenCode has native Copilot integration now via /connect (https://github.blog/changelog/2026-01-16-github-copilot-now-supports-opencode/) that works out of the box. Also ensure model IDs use periods for versions: github-copilot/claude-opus-4.5 (not claude-opus-4-5).

Antigravity-related: There are two separate bugs:

  1. Tool schema format (Unknown name "parameters") - This issue (#8857) - affects Gemini 3 models. As workaround: use Claude models via Antigravity instead.

  2. Thinking/signature/type format (Unknown name "thinking", "signature", "type") - This affects Claude models (both thinking AND non-thinking). I've opened a separate issue for this on the Antigravity plugin repo: https://github.com/NoeFabris/opencode-antigravity-auth/issues/245)

Both are upstream Antigravity plugin bugs.

@chindris-mihai-alexandru commented on GitHub (Jan 18, 2026): @noises1990 Copilot-related: Check if you have a custom github-copilot provider in opencode.json. If so, remove it entirely. OpenCode has native Copilot integration now via /connect (https://github.blog/changelog/2026-01-16-github-copilot-now-supports-opencode/) that works out of the box. Also ensure model IDs use periods for versions: github-copilot/claude-opus-4.5 (not claude-opus-4-5). Antigravity-related: There are two separate bugs: 1. Tool schema format (Unknown name "parameters") - This issue (#8857) - affects Gemini 3 models. As workaround: use Claude models via Antigravity instead. 2. Thinking/signature/type format (Unknown name "thinking", "signature", "type") - This affects Claude models (both thinking AND non-thinking). I've opened a separate issue for this on the Antigravity plugin repo: https://github.com/NoeFabris/opencode-antigravity-auth/issues/245) Both are upstream Antigravity plugin bugs.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6459