Skip to content

cli: provider stream failures retry silently forever - looks like a hang with no console feedback #49030

Closed as not planned

Description

@magicprinc

Summary

Selecting a model whose upstream endpoint fails (currently opencode-go/deepseek-v4.1-flash, which returns HTTP 503 "Endpoint is unavailable" from the Zen Go router) makes OpenCode retry the stream silently and indefinitely. The CLI produces no output and no error, so a 1.6-second upstream failure looks like an endless hang.

Environment

  • opencode version: 2.0.3
  • OS: Windows 10 Pro 10.0.19045 (MINGW64_NT-10.0-19045, x86_64)
  • Terminal: Windows console, TERM=xterm-256color
  • Shell: Git Bash (bash 3.6.10, MINGW64)
  • Install/channel: latest, npm package @opencode/[email protected]
  • Active plugins: @franlol/opencode-md-table-formatter@latest, @prevalentware/opencode-goal-plugin (the goal plugin currently fails to load with a SchemaError — unrelated, noted for completeness)

Reproduction

  1. Run against the shared background service:
    timeout 90 opencode run -m opencode-go/deepseek-v4.1-flash "Reply with exactly: OK"
  2. Observe: no output, no error, process never exits. After 90s timeout kills it (exit 124) with 0 bytes of output.
  3. Direct test bypassing OpenCode confirms the trigger — POST to https://opencode.ai/zen/go/v1/chat/completions with x-opencode-session header:
    • model deepseek-v4.1-flash → HTTP 503 in ~1.6s:
      {"error":{"type":"server_error","message":"Error from provider (Console Go): Upstream request failed: Endpoint is unavailable."}}
    • control model deepseek-v4-pro → HTTP 200 in ~2s, normal completion.

Expected Behavior

The client should surface an error such as "provider request failed (503): Endpoint is unavailable" and stop (or retry a bounded number of times with visible feedback), instead of waiting forever with no console messages.

Actual Behavior

  • The client submits the message and holds GET /api/event and POST /api/session/<id>/wait open; the server never completes the session.
  • ~/.local/share/opencode/log/opencode.log for the hung session shows no stream providerID=... entry, no retry entries, and no provider error — nothing between cli starting and the eventual client-side interrupt.
  • Earlier logs (Aug 14) show the same class of failure with a silent retry loop: repeated stream providerID=opencode-go ... + llm runtime selected entries every ~7s for a minute+, never surfaced to the user.

Additional Context

  • Reproduces consistently for this model; started right after the model appeared in the catalog (release_date 2026-09-10). Works fine with opencode-go/deepseek-v4-pro and opencode-go/deepseek-v4-flash (both verified end-to-end).
  • Workaround: use opencode-go/deepseek-v4-pro or opencode-go/deepseek-v4-flash.
  • Side observation: the official deepseek/deepseek-v4-flash provider also stalls (API returns 200 headers but the body never completes) — separate upstream issue.

Activity

  1. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

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

  2. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the detailed report. I tried to reproduce this on @opencode/[email protected]. I pointed opencode run at a mock OpenAI-compatible provider that always answers with HTTP 503 and the same body you got from the Go router (Upstream request failed: Endpoint is unavailable.), with and without your two plugins.

    In both cases OpenCode retried a few times, about 30–35s in total, then printed Error: Error from provider (Console Go): Upstream request failed: Endpoint is unavailable. and exited with code 1. So a 503 from the provider doesn't seem to cause an endless retry on its own. One thing does match your report: while it retries, the only feedback is a repeated > build · flash line, with no reason shown.

    Your log for the hung session has no stream providerID=... entry at all. That suggests the stall happens before any model request is sent, maybe in the shared background service. These would help narrow it down:

    • Does it still hang with a private server, i.e. opencode run --standalone -m opencode-go/deepseek-v4.1-flash "Reply with exactly: OK"? And does it still hang after opencode service restart?
    • The role=server lines from ~/.local/share/opencode/log/opencode.log for one hung run, ideally with OPENCODE_LOG_LEVEL=DEBUG set (please redact keys and prompts).
    • Does it still happen on the latest release (opencode upgrade)?
  3. opencodejr commented on Oct 31, 2026

    @opencodejr
    Contributor

    We're closing this for now because we haven't heard back. When we tested opencode run on 2.0.3 against a provider that always returns HTTP 503 with the same Endpoint is unavailable body, OpenCode retried a few times. After about 30–35 seconds it printed the error and exited with code 1, and it didn't hang. Your log has no stream providerID=... entry, so the hang you saw probably happens before any model request is sent. We'd need more details to track that down.

    If it still happens, please reply here and we can reopen it. These would help most:

    • whether opencode run --standalone ... (or a run after opencode service restart) also hangs
    • the role=server log lines from one hung run, ideally with OPENCODE_LOG_LEVEL=DEBUG (please redact keys and prompts)
    • whether it still happens on the latest release

    Thanks for the detailed report.

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