Skip to content

Go gateway: SSE streaming requests over HTTP/1.1 return HTTP 500 (Endpoint is unavailable) #42843

Closed as not planned

Description

@118Gavin

Description

Summary

Streaming (SSE) chat completion requests to the opencode-go gateway endpoint https://opencode.ai/zen/go/v1/chat/completions return HTTP 500 with body {"type":"error","error":{"type":"error","message":"Internal server error"}} when sent over HTTP/1.1. The same request over HTTP/2 succeeds (HTTP 200 with normal SSE chunks). Non-streaming requests over HTTP/1.1 also succeed.

This surfaces in OpenChamber/openCode sessions as AI_APICallError: Upstream request failed: Endpoint is unavailable. for provider opencode-go (e.g. deepseek-v4-flash), in recurring bursts (retries all fail for several minutes, then recover).

Evidence

  • HTTP/1.1 + stream:true -> always HTTP 500 (reproduced 10+ times)
  • HTTP/1.1 non-streaming: HTTP 200 (5/5)
  • HTTP/2 (node http2) + stream:true -> HTTP 200, normal SSE stream
  • opencode CLI 1.18.18 (bun, HTTP/2) with opencode-go/deepseek-v4-flash works fine
  • Request body/headers captured from the working client and replayed via curl over HTTP/1.1 still 500s: {"model":"deepseek-v4-flash","max_tokens":32000,"top_p":0.95,"messages":[...],"tool_choice":"auto","stream":true,"stream_options":{"include_usage":true}}

Expected

Streaming over HTTP/1.1 should work like any OpenAI-compatible endpoint (other providers do). Or at minimum return a meaningful status/error instead of a generic 500.

Plugins

None

OpenCode version

1.18.18 (bundled with OpenChamber desktop)

Steps to reproduce

  1. curl.exe -X POST "https://opencode.ai/zen/go/v1/chat/completions" -H "Authorization: Bearer " -H "Content-Type: application/json" -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"hi"}],"stream":true}' -> HTTP 500 {"type":"error","error":{"type":"error","message":"Internal server error"}}
  2. Same request without "stream":true -> HTTP 200, normal completion
  3. Same request over HTTP/2 (e.g. node http2 module, or bun fetch used by the opencode CLI) -> HTTP 200, normal SSE stream

Screenshot and/or share link

No response

Operating System

Windows 11

Terminal

OpenChamber desktop (bundled opencode-cli)

Activity

  1. github-actions commented on Aug 16, 2026

    @github-actions
    Contributor

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

    If your issue is specifically about HTTP/1.1 streaming being broken while HTTP/2 streaming works (i.e. a protocol-level difference rather than intermittent unavailability), it may be distinct from the above — the HTTP/1.1 vs HTTP/2 reproduction steps make this a useful data point worth keeping separate if that distinction holds up.

  2. 118Gavin commented on Aug 16, 2026

    @118Gavin
    Author

    Thanks for the duplicate check. This one is a distinct data point worth keeping: it isolates a deterministic protocol-level difference (HTTP/1.1 + SSE -> guaranteed 500; HTTP/2 + SSE -> 200, 100% reproducible in the same minute from the same machine/key/network), not intermittent unavailability.

    Comparison with the referenced issues:

    Reproduction is one curl call, so it's cheap for the assignee to verify: curl -X POST https://opencode.ai/zen/go/v1/chat/completions -H "Authorization: Bearer <key>" -d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"hi"}],"stream":true}' -> HTTP 500; same request via HTTP/2 (node http2) -> 200.

    Also worth noting for the outage angle: #40480 mentions an "OpenCode Go China-hosted model opt-in" console setting — my traffic is from a China IP; if that opt-in routes to different upstreams, it may be relevant to the burst pattern. Happy to close as duplicate of #40480 if maintainers prefer, but the h1.1/h2 repro is unique to this report.

  3. 118Gavin commented on Aug 16, 2026

    @118Gavin
    Author

    Additional data point for the assignee: the account in question has the "Enable models hosted in China" opt-in enabled the whole time (and the failure is Endpoint is unavailable/500, never the 403 RegionError from the opt-in gate). So this is not the opt-in/RegionError class of issue (#39845) — it's the gateway's streaming path failing even for China-hosted routing. The h1.1-vs-h2 repro in the body stands as-is.

  4. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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