Skip to content

[Bug] OpenCode Go: deepseek-v4.1-flash 403 "Upstream response was not valid JSON" with large payload #50897

Closed as not planned

Description

@Zowlak

Description

On OpenCode Go (subscription), deepseek-v4.1-flash returns HTTP 403 Upstream request failed: [server_error] Upstream response was not valid JSON ONLY when the request combines reasoning_effort: "high" with a large payload (~600 KB / ~150k tokens).
Same request with reasoning_effort: "low" or without the field succeeds. Small payloads with "high" succeed. Failing intermittently since 2026-09-23 09:15 UTC; the model worked fine before (800+ successful calls on the same account).

Server-side console log of a failing request:

{ "requestedModel": "deepseek-v4.1-flash", "model": "deepseek-v4p1-flash",
  "provider": "opencode", "statusCode": 403,
  "errorCode": "upstream_response_status_not_200",
  "reasoningMode": "effort", "reasoningEffort": "high", "stream": true,
  "path": "/inference/go/openai/v1/chat/completions",
  "attempts": [{ "provider": "opencode", "model": "deepseek-v4p1-flash",
                 "statusCode": 403, "durationMs": 44,
                 "errorCode": "upstream_response_status_not_200" }] 
}

Note: deepseek-v4p1-flash (the id actually served) is NOT listed in GET /zen/go/v1/models.

Plugins

None (client is OpenAI-compatible, not the opencode CLI)

OpenCode version

N/A as CLI — failing client is Hermes Agent 0.21.3 (User-Agent: HermesAgent/0.21.3) hitting the Go server API

Steps to reproduce

  1. POST https://opencode.ai/zen/go/v1/chat/completions (same as /inference/go/openai/v1/chat/completions) with model=deepseek-v4.1-flash, stream: true, tools, messages ≈ 600 KB (~150k tokens), and reasoning_effort: "high". Header x-opencode-session: .
  2. Response: HTTP 403 {"error":{"type":"server_error","code":"server_error", "message":"Upstream request failed: [server_error] Upstream response was not valid JSON"}}.
  3. Repeat the identical request with reasoning_effort: "low" → HTTP 200, full streamed reply.
  4. Repeat without reasoning_effort → HTTP 200.
  5. Small payload + reasoning_effort: "high" → HTTP 200.
    This A/B was verified on 2026-09-23 ~11:35 UTC.

Screenshot and/or share link

No response

Operating System

Linux (headless container, Debian-based)

Terminal

N/A (server-side API call, not a terminal client)

Activity

  1. Zowlak commented on Sep 23, 2026

    @Zowlak
    Author

    Update : the trigger is NOT reasoning_effort-specific. Re-running the A/B 30 min later: low fails and high succeeds (inverted). It is an intermittent, size-correlated upstream failure: payloads ≈600 KB fail ~15–35% of attempts regardless of reasoning_effort; payloads <~50 KB never failed across ~20 attempts.
    Consistent with #50761 (route-dependent context limits in long sessions).

  2. changed the title [-][Bug] OpenCode Go: deepseek-v4.1-flash 403 "Upstream response was not valid JSON" with reasoning_effort=high + large payload[/-] [+][Bug] OpenCode Go: deepseek-v4.1-flash 403 "Upstream response was not valid JSON" with large payload[/+] on Sep 23, 2026
  3. 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

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