Bug: 'Invalid request body' with github-copilot/gemini-3-pro-preview model #3353

Closed
opened 2026-02-16 17:39:44 -05:00 by yindo · 2 comments
Owner

Originally created by @dani931004 on GitHub (Dec 6, 2025).

Description

When using the opencode CLI with the github-copilot/gemini-3-pro-preview model, the tool fails with an "invalid request body" error.

Environment

  • OS: Linux
  • opencode version: Standalone binary installation located at /home/dani/.opencode/bin/opencode.

Steps to Reproduce

  1. Configure the opencode CLI to use github-copilot/gemini-3-pro-preview as the model.
  2. Run a command that invokes the model (e.g., opencode "your prompt here").
  3. The request fails with an "invalid request body" error from the upstream API.

Investigation Details

During a debugging session, the following was determined:

  • The issue appears to stem from the opencode-gemini-auth plugin, which is bundled within the standalone binary.
  • This plugin transforms requests for Gemini models to a format expected by the cloudcode-pa.googleapis.com endpoint.
  • This transformation seems to be incorrectly applied to the github-copilot/gemini-3-pro-preview model, causing the API to reject the request body.
  • Since the opencode installation is a single binary, it was not possible to patch the bundled plugin code to bypass this transformation for the specific model.
  • Attempts to override the behavior via opencode.json configuration were also unsuccessful.

Suggested Fix

The opencode-gemini-auth plugin should likely not apply its specific request body transformation when the model is github-copilot/gemini-3-pro-preview. The request should be passed through to the standard Gemini API endpoint without modification.

Originally created by @dani931004 on GitHub (Dec 6, 2025). ### Description When using the `opencode` CLI with the `github-copilot/gemini-3-pro-preview` model, the tool fails with an "invalid request body" error. ### Environment * **OS:** Linux * **`opencode` version:** Standalone binary installation located at `/home/dani/.opencode/bin/opencode`. ### Steps to Reproduce 1. Configure the `opencode` CLI to use `github-copilot/gemini-3-pro-preview` as the model. 2. Run a command that invokes the model (e.g., `opencode "your prompt here"`). 3. The request fails with an "invalid request body" error from the upstream API. ### Investigation Details During a debugging session, the following was determined: * The issue appears to stem from the `opencode-gemini-auth` plugin, which is bundled within the standalone binary. * This plugin transforms requests for Gemini models to a format expected by the `cloudcode-pa.googleapis.com` endpoint. * This transformation seems to be incorrectly applied to the `github-copilot/gemini-3-pro-preview` model, causing the API to reject the request body. * Since the `opencode` installation is a single binary, it was not possible to patch the bundled plugin code to bypass this transformation for the specific model. * Attempts to override the behavior via `opencode.json` configuration were also unsuccessful. ### Suggested Fix The `opencode-gemini-auth` plugin should likely not apply its specific request body transformation when the model is `github-copilot/gemini-3-pro-preview`. The request should be passed through to the standard Gemini API endpoint without modification.
yindo closed this issue 2026-02-16 17:39:44 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 6, 2025):

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

  • #4468: github copilot: Gemini 3.0 invalid body request - Reports the same "invalid request body" error when using GitHub Copilot's Gemini 3.0 model
  • #4816: Could not use model "Gemini 3 Pro Preview" of Github copilot provider: "invalid request body" - Nearly identical issue with the same error and model combination (now closed)

Feel free to ignore if your specific case differs from these.

@github-actions[bot] commented on GitHub (Dec 6, 2025): This issue might be a duplicate of existing issues. Please check: - #4468: github copilot: Gemini 3.0 invalid body request - Reports the same "invalid request body" error when using GitHub Copilot's Gemini 3.0 model - #4816: Could not use model "Gemini 3 Pro Preview" of Github copilot provider: "invalid request body" - Nearly identical issue with the same error and model combination (now closed) Feel free to ignore if your specific case differs from these.
Author
Owner

@dani931004 commented on GitHub (Dec 6, 2025):

Closing as a duplicate of #4816 and #4468. All relevant context will be added to the existing threads.

@dani931004 commented on GitHub (Dec 6, 2025): Closing as a duplicate of #4816 and #4468. All relevant context will be added to the existing threads.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3353