Skip to content

[BUG]: Go - Error 400 - Gemini 4 Argon - Requests ending with a model turn are not supported #64628

Open

Description

@amirsaam

Description

Gemini 4 Argon in OpenCode Go subscription for some reason is not usable for me
I searched for similar issues but they were not specific to Model Turn error
I have no idea what does this error mean at all

Plugins

None

OpenCode version

2.3.2

Steps to reproduce

  1. Start a new empty session / Change model in any session to Gemini 4 Argon
  2. Prompt anything
  3. Wait a while
  4. Gemini 4 Argon sends out an 400 error for Model Turn

Screenshot

Screenshot 1405-08-27 at 13 44 32

Operating System

macOS 27.2.1

Terminal

None, I use desktop app

Activity

  1. added
    area/providers
    inference/go
    type/bug
    version/v2
    on Nov 18, 2026
  2. opencodejr commented on Nov 18, 2026

    @opencodejr
    Contributor

    Thanks for the report. I tried to reproduce this on OpenCode 2.3.2 but couldn't confirm it without a real OpenCode Go account, which I don't have here.

    What I checked: I sent OpenCode's Gemini requests to a local mock server that answers like Gemini and recorded the shape of every request. I tried several cases: a plain prompt in a new session, a tool call followed by its continuation, a reasoning-only reply, a reply cut off at the output limit, an empty reply, a stream that stops early (which OpenCode retries), server errors, and a second prompt in the same session. Every request OpenCode sent ended on a user turn. The error you see means Gemini received a request that ends on a model turn, so none of these cases triggered it. I also used the CLI rather than the desktop app.

    A maintainer with a Go subscription will need to look at this. A few details would help them:

    • Does it fail on the very first reply, or only after the model has run some tools (the "wait a while" step)?
    • Does it also happen with gemini-4-argon-contributor, or with the CLI (opencode run -m opencode-go/gemini-4-argon "hi")?
    • The server log lines around the error. In other V2 reports the log was at ~/.local/share/opencode/log/opencode.log. Please remove anything private before posting.

    Related: #55694 shows the same Gemini error on V2 through OpenRouter, where it happens right after the read tool returns an image. If your prompt makes the model read images, it may be the same cause.

  3. amirsaam commented on Nov 18, 2026

    @amirsaam
    Author
    • It does some reads and tool calls then stops, never produced any output
    • The model ID in console is: gemini-4-argon, I see no gemini-4-argon-contributor for OpenCode Go subscription
    • Logs:
    timestamp: 2026-11-18T09:51:36.154Z
    level: ERROR
    run: b5f7e443
    role: server
    sessionID: ses_e11ef4596ffeIwetyCDhF64WjZ
    
    message: Failed to drain Session
    
    cause:
      AI.Error: Upstream request failed: [400]
      Requests ending with a model turn are not supported.
    
      Stack trace:
        at Hpe (/$bunfs/root/chunk-anztkf4c.js:3:3000)
        at <anonymous> (/$bunfs/root/chunk-anztkf4c.js:3:2692)
        at SessionStep.attempt (/$bunfs/root/chunk-4w17r1gc.js:493:4020)
        at SessionStep.attempt (definition) (/$bunfs/root/chunk-4w17r1gc.js:478:304)
        at SessionRunner.runStep (/$bunfs/root/chunk-4w17r1gc.js:493:2914)
        at SessionRunner.runStep (definition) (/$bunfs/root/chunk-4w17r1gc.js:493:3114)
        at SessionRunner.drain (/$bunfs/root/chunk-4w17r1gc.js:493:6653)
        at SessionRunner.drain (definition) (/$bunfs/root/chunk-4w17r1gc.js:493:438)
        at ServerProcess.start (/$bunfs/root/chunk-ajf736hz.js:3:6119)
        at ServerProcess.start (definition) (/$bunfs/root/chunk-4w17r1gc.js:595:37325)
    
      [cause]:
        AI.Error.InvalidRequest: Upstream request failed: [400]
        Requests ending with a model turn are not supported.
    
        Stack trace:
          at uu (/$bunfs/root/chunk-anztkf4c.js:3:1230)
          at Hpe (/$bunfs/root/chunk-anztkf4c.js:3:3011)
          at <anonymous> (/$bunfs/root/chunk-anztkf4c.js:3:2692)
    

    My failed request IDs that shown in the screenshot are:

    1: 01a1ee25-6e5e-7708-afcf-eeb3c81cf6d7
    2: 01a1ee11-a3a6-7e92-838a-20c619f5f5eb

    Maybe this could help.

  4. opencode-agent commented on Nov 18, 2026

    @opencode-agent
    Contributor

    Thanks for the request IDs, they helped a lot. Both reached Google, and Google rejected them immediately because the conversation OpenCode sent ended on the model's turn. In your session, it happens on the request right after a round of tool calls.

    To find out why those tool results were missing, could you send us the session export? From a terminal:

    opencode session export ses_e11ef4596ffeIwetyCDhF64WjZ > session.json

    Please email session.json, along with ~/.local/share/opencode/log/opencode.log from around the time of the failure, to [email protected] rather than posting them here, since they contain your conversation and file contents. If you'd rather redact them first, --sanitize removes transcript and file data, but the full export is more useful to us.

    We're also adding a fix so Gemini requests can't end on a model turn.

  5. amirsaam commented on Nov 18, 2026

    @amirsaam
    Author

    Unfortunately I've undid the messages on that session and started from zero, so the session log is lost but kept those errors too in the log report file for you
    I started a new session and reproduced the error and exported that with request id of 01a1ee6d-d478-7827-ab6a-7d4f6d947882
    Sent those files to the provided email address

  6. neriousy commented on Nov 18, 2026

    @neriousy
    Member

    Thanks for sending the files over!

    One quick question: did you have a goal running in those sessions (the /goal command) when the error showed up?

  7. amirsaam commented on Nov 18, 2026

    @amirsaam
    Author

    @neriousy no i don't have any plugin nor a goal command used anywhere
    p.s: no problem, my pleasure.

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

    area/providersinference/goplatform/macostype/bugversion/v2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions