Skip to content

OpenCode Go DeepSeek V4.1 Flash intermittently returns HTTP 400 with only model name #51990

Closed as duplicate

Description

@tempest2023

Description

I use an active OpenCode Go subscription through Codex, with GPT-6 handling planning and opencode-go/deepseek-v4.1-flash handling delegated execution. Codex talks to Go through a local Codex Router → LiteLLM → API forwarder. Intermittent HTTP 400s now interrupt many tasks, often while a DeepSeek sub-agent is working. This was rare when I started using this setup about a week ago and has become frequent enough to affect nearly every conversation.

The client shows:

opencode rejected the request for DeepSeek V4.1 Flash (opencode Go). (HTTP 400: Error code: 400 - {'model': 'deepseek-v4.1-flash'})

My local router's LiteLLM error log also contains only Error code: 400 - {'model': 'deepseek-v4.1-flash'}. There is no field-level error message. Successful calls to the same model occur immediately before and after these failures. I do not see matching failed entries in the Go Console's Inference log, although it may omit requests rejected before inference.

Local evidence

For opencode-go/deepseek-v4.1-flash, my local request ledger recorded these HTTP 400 counts (UTC dates):

Date HTTP 400s
Sep 25 1
Sep 26 4
Sep 27 9
Sep 28 4
Sep 29, partial day 2

Examples (UTC; IDs are local router request suffixes, not OpenCode request IDs):

  • Sep 26 05:10:17, :7356
  • Sep 27 08:16:04, :11051
  • Sep 27 17:28:41, :20746
  • Sep 28 00:01:47, :25679
  • Sep 28 23:05:01, :32591
  • Sep 29 02:15:23, :32833

The Sep 28 00:01:47 failure occurred on the model request following two image-tool results, but other image requests in that session succeeded. The issue also occurs in other task contexts, so I cannot attribute it to images. The local API forwarder is configured to add x-opencode-session for Go; I have not captured the actual outbound headers of a failing request.

Steps to reproduce

  1. Use a Go subscription and route Codex agent/sub-agent conversations to deepseek-v4.1-flash through an OpenAI-compatible proxy.
  2. Run multi-turn coding tasks with tools and delegated agents.
  3. Observe intermittent HTTP 400 responses with only {'model': 'deepseek-v4.1-flash'} as the reported error, while adjacent requests succeed.

I do not yet have a deterministic minimal reproduction. Could you check whether these timestamps correspond to Go gateway rejections that are absent from the Inference log, and advise which response header/request ID we should capture? I would also welcome guidance on whether the gateway returns a more detailed error body than the one surfaced by LiteLLM. I can provide sanitized request metadata or additional timestamps privately.

Environment

  • Client: Codex desktop on macOS, with GPT-6 root agents and DeepSeek V4.1 Flash delegated agents
  • Provider/model: OpenCode Go / deepseek-v4.1-flash
  • Transport: Codex Router → LiteLLM → local API forwarder → OpenCode Go chat/completions
  • OpenCode CLI: not used for these requests

Activity

  1. github-actions commented on Sep 29, 2026

    @github-actions
    Contributor

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

  2. SamSpiri commented on Sep 29, 2026

    @SamSpiri

    Your side of this is Codex → LiteLLM → forwarder rather than OpenCode, so the OpenCode plugin below will not apply to you directly — but the retry policy it encodes is the general shape, and invites testers from the OpenCode side:

    https://github.com/SamSpiri/opencode-go-stub-400-retry

    Treat the bare-body rejection (status 400, JSON object containing only model, no error/message) as transient and retry it a couple of times with backoff; keep any 400 that carries a real reason terminal. That is a mirror of the guard you already have working, and your ledger is the best evidence in this thread that the classification is worth flipping.

    One observation relevant to triage here: your daily counts (1, 4, 9, 4, 2) with successes immediately before and after, and nothing matching in the Console Inference log, look like a flaky-route/replica signature rather than a verdict on the payload — consistent with #51201's byte-identical 200/400/200 replay. That suggests the per-request outcome is not determined by your prompt, which is also why a client-side retry should recover it.

    If you do test the equivalent in LiteLLM, a note here on whether it recovers would help — it would be a second stack confirming the retryability claim.

  3. Bigbrotha12 commented on Sep 30, 2026

    @Bigbrotha12

    Adding another datapoint — same symptom on opencode v2.0.18 with the default OpenCode Go provider using opencode-go/deepseek-v4.1-flash.

    • Failures are sporadic, roughly 1 in 5–10 requests, and seem random — subsequent requests in the same session succeed.
    • Account limits/status confirmed fine, so it's not quota.
    • Not specific to very long sessions either — we see it on ordinary mid-session turns (after tool calls).

    The server log shows the failure surfaces while draining the session (i.e., sending the compiled request back to the provider), as AI.Error.InvalidRequest with no provider body:

    level=ERROR message="Failed to drain Session" cause="AI.Error: Provider request failed with HTTP 400
      at h5 (/$bunfs/root/chunk-3dv1eb1d.js:17:3523)
      at <anonymous> (/$bunfs/root/chunk-3dv1eb1d.js:17:3216)
      at SessionStep.attempt (/$bunfs/root/chunk-61ch0ng5.js:377:3586)
      at SessionRunner.runStep (/$bunfs/root/chunk-61ch0ng5.js:377:2625)
      at SessionRunner.drain (/$bunfs/root/chunk-tmnwny93.js:24:2279)
      at ServerProcess.start (/$bunfs/root/chunk-9h6dnfvq.js:2:6473)
    {
      [cause]: AI.Error.InvalidRequest: Provider request failed with HTTP 400
          at Fa (/$bunfs/root/chunk-3dv1eb1d.js:17:1117)
          at h5 (/$bunfs/root/chunk-3dv1eb1d.js:17:3534)
    }"
    role=server
    

    The recurring theme across the related issues (#51530, #50446, #51201, #50761) is that opencode-go returns an opaque 400 and opencode surfaces only the status code — so it's impossible to tell whether this is an upstream DeepSeek rejection, a context-limit edge case, or a gateway bug. Passing through the provider's response body (even raw) would help a lot in triaging.

    Environment: opencode v2.0.18, Fedora 43 x86_64 (Linux 7.2.7-100.fc43), alacritty/truecolor, latest channel, no plugins.

  4. neriousy commented on Oct 20, 2026

    @neriousy
    Member

    Thanks for the report. We're tracking this same intermittent DeepSeek V4.1 Flash HTTP 400 response containing only the model name in #51201, so I'm closing this as a duplicate. Please follow that issue for updates.

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