Skip to content

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

Closed

Description

@dani931004

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.

Activity

  1. github-actions commented on Dec 6, 2025

    @github-actions
    Contributor

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

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

  2. dani931004 commented on Dec 6, 2025

    @dani931004
    Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions