Skip to content

bug: OpenCode Go deepseek-flash returns 400 inference_failed on oversized payloads with max reasoning effort #52174

Closed as not planned

Description

@amin-bake

Description

Bug Reproduction / Diagnostic Logs

I am hitting this exact 400 inference_failed error when attempting to use deepseek-flash with max reasoning effort on larger code contexts via the Zed editor. 

Looking closely at the request payload, the gateway appears to crash/timeout when handling large payload contexts combined with high reasoning modes. 

Observed Context & Behavior: 

  • Payload Size: The request body size is extremely large ("content-length": "2527429", ~2.5 MB), which likely triggers a buffer overflow or proxy-level processing timeout on OpenCode Go.
  • Reasoning Parameters: The request was initiated with "reasoningMode": "effort" and "reasoningEffort": "max".
  • Gateway Timeout: The upstream attempt failed right around the ~11.5-second mark ("durationMs": 11548).
{
  "event": {
    "id": "ef9f997c-7299-4737-9c28-65886993fcb2",
    "requestID": "ef9f997c-7299-4737-9c28-65886993fcb2",
    "workspaceID": "org_01M2ZD6V5KM9RQVTEY1JGXY7GD",
    "startedAt": 1790715792274,
    "finishedAt": 1790715804530,
    "durationMs": 12256,
    "outcome": "failed",
    "category": "inference",
    "protocol": "openai-chat",
    "product": "go",
    "path": "/inference/go/openai/v1/chat/completions",
    "method": "POST",
    "stream": true,
    "sessionID": "620d6e9c-d11d-4528-920d-48517dc65a7c",
    "userAgent": "Zed/1.21.0+stable.362.33c95853ed2b6956f339733c63a8220964ecbeb6 (windows; x86_64)",
    "requestedModel": "deepseek-flash",
    "model": "deepseek-flash",
    "provider": "opencode",
    "statusCode": 400,
    "errorCode": "inference_failed",
    "reasoningMode": "effort",
    "reasoningEffort": "max",
    "requestHeaders": {
      "accept": "*/*",
      "content-length": "2527429",
      "content-type": "application/json"
    },
    "attempts": [
      {
        "provider": "opencode",
        "model": "deepseek-flash",
        "statusCode": 400,
        "durationMs": 11548,
        "errorCode": "inference_failed"
      }
    ]
  }
}

Use code with caution.

Is there an internal context compression or maximum request size constraint missing on the OpenCode gateway for the openai-chat protocol mapping? Any insight or a workaround to clip the buffer size would be appreciated!

Plugins

none

OpenCode version

V2 through Zed IDE Agent Panel

Steps to reproduce

  1. Open a large project workspace or a single file containing a substantial codebase in the Zed Editor (v1.21.0+).
  2. Configure your settings.json to route models through OpenCode Go using deepseek-flash with max reasoning effort:
    "language_models": {
      "opencode": {
        "model": "deepseek-flash",
        "reasoning_mode": "effort",
        "reasoning_effort": "max"
      }
    }
  3. Open the Chat Panel (Ctrl+Shift+I) or trigger an Inline Assistant slash command.
  4. Input a prompt that causes Zed to pull extensive workspace context (e.g., /file or /workspace), pushing the outgoing request payload size significantly high (~2.5 MB / content-length: 2527429).
  5. Submit the prompt and observe the connection hang for roughly 11-12 seconds before crashing with a 400 Bad Request and an inference_failed error code.

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Zed IDE Agent Panel

Activity

  1. changed the title [-]bug: OpenCode Go deepseek-flashreturns 400inference_failed on oversized payloads with max reasoning effort[/-] [+]bug: OpenCode Go deepseek-flash returns 400inference_failed on oversized payloads with max reasoning effort[/+] on Sep 29, 2026
  2. changed the title [-]bug: OpenCode Go deepseek-flash returns 400inference_failed on oversized payloads with max reasoning effort[/-] [+]bug: OpenCode Go deepseek-flash returns 400 inference_failed on oversized payloads with max reasoning effort[/+] on Sep 29, 2026
  3. changed the title [-]bug: OpenCode Go deepseek-flash returns 400 inference_failed on oversized payloads with max reasoning effort[/-] [+]bug: OpenCode Go deepseek-flash returns 400 `inference_failed` on oversized payloads with max reasoning effort[/+] on Sep 29, 2026
  4. github-actions commented on Sep 29, 2026

    @github-actions
    Contributor

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

    • #51201: OpenCode Go DeepSeek long requests intermittently return an opaque HTTP 400, including on replay of the same payload.
    • #51434: DeepSeek V4.1 Flash on OpenCode Go returns an opaque 400 ({"model":"deepseek-v4.1-flash"}) after tool-use turns.
    • #50761: Long DeepSeek requests can fail with HTTP 400 due to route-dependent context limits.
    • #50897: Large DeepSeek Flash payloads combined with high reasoning effort fail at the OpenCode Go gateway.
  5. amin-bake commented on Sep 29, 2026

    @amin-bake
    Author

    The issue can be temporarily resolved by compacting the chart using the /compact command. The bug can be reproduced using the Steps to reproduce guide.

  6. neriousy commented on Oct 21, 2026

    @neriousy
    Member

    Thanks for the report. This is about how the model itself behaves when served through OpenCode Go (repeating itself, broken tool calls, speed, or rejecting large requests), not a bug in the OpenCode app. We pass these reports to our upstream providers. Starting a new session or running /compact usually helps with loops and oversized-request errors. Closing this to keep the tracker focused; the main discussion is in #50206.

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

Metadata

Metadata

Assignees

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