Skip to content

[Bug] qwen3.7-max/plus on OpenCode Go (Zen API) - frequent 524 timeout behind Cloudflare (related to #32418) #33726

Closed as not planned

Description

@Joelincn

Description

qwen3.7-max and qwen3.7-plus on OpenCode Go (Zen API) intermittently fail with timeouts. The root cause is Cloudflare in front of opencode.ai having a 120s proxy read timeout. When qwen3.7 generation (especially with thinking mode) takes longer than 120s, Cloudflare returns a 524 timeout error as HTML, which the AI SDK cannot parse as JSON, resulting in cryptic errors and infinite retries.

This matches the findings in #32418 by @BernhardGruen.

Steps to Reproduce

  1. Send a POST request to https://opencode.ai/zen/go/v1/messages with qwen3.7-max or qwen3.7-plus
  2. Enable thinking mode (e.g., thinking: {type: "enabled", budget_tokens: 1000})
  3. Observe intermittent 524 timeout from Cloudflare after ~120s

Expected Behavior

  • Requests should not be killed by Cloudflare timeout at 120s
  • If timeout occurs, the API should return a proper JSON error response, not an HTML page

Actual Behavior

Cloudflare returns a 524 HTML error page, which the client SDK interprets as an empty ("") error message, triggering automatic retries that also timeout.

Environment

  • Service: OpenCode Go (Zen API) — paid subscription
  • Endpoint: https://opencode.ai/zen/go/v1/messages
  • Models affected: qwen3.7-max, qwen3.7-plus
  • Client: OpenClaw (third-party, using @ai-sdk/anthropic)
  • Region: Mainland China (via proxy)

Suggested Fix

  1. Server-side (long-term): Increase Cloudflare proxy read timeout for qwen3.7 endpoints, or implement streaming responses that keep the connection alive
  2. Server-side (short-term): Translate 524/5xx errors into proper JSON error responses instead of passing through raw Cloudflare HTML
  3. Client-side fallback: The AI SDK could detect HTML response bodies and produce human-readable error messages instead of empty strings

Related

Activity

  1. github-actions commented on Jun 24, 2026

    @github-actions
    Contributor

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

    If this issue provides new technical detail (the Cloudflare 524 root cause) beyond what was already reported, consider adding that information to one of the existing issues rather than opening a new one.

  2. Joelincn commented on Jun 24, 2026

    @Joelincn
    Author

    Additional Analysis and Test Data

    Adding more context that was in my original report (#33721) but omitted due to the template format.

    Full Test Results (via curl to https://opencode.ai/zen/go/v1/messages)

    Test Model Config Result Latency
    T1 qwen3.7-max no thinking ✅ Success <1s
    T2 qwen3.7-max thinking enabled (budget=1000) ❌ Timeout (x2) 60s+
    T3 qwen3.7-plus no thinking ❌ Timeout (x2) 60s+
    T4 qwen3.7-max thinking budget=5000 ✅ Success ~8s
    T5 qwen3.7-plus thinking enabled (budget=1000) ❌ Timeout first try, ✅ Success on retry First: 60s, Second: ~40s

    Pattern Analysis

    The non-deterministic behavior also suggests backend resource contention or insufficient qwen3.7 instance allocation:

    1. No thinking on qwen3.7-max works perfectly (T1) — fast path, minimal compute
    2. Simple thinking (budget=1000) on qwen3.7-max consistently times out (T2 x2) — should be faster than T4
    3. Complex thinking (budget=5000) on qwen3.7-max works fine (T4) — takes longer but succeeds
    4. qwen3.7-plus shows similar intermittent behavior (T3, T5)

    The fact that T4 (larger budget) works while T2 (smaller budget) does not is particularly puzzling. One hypothesis: under load, the backend may be deprioritizing or prematurely terminating certain requests. The Cloudflare 524 timeout (from #32418) is one piece of the puzzle, but the wide variance in response times suggests qwen3.7 instances may be under-provisioned.

    Other models work fine

    • deepseek-v4-pro, deepseek-v4-flash, and other non-qwen models on the same endpoint work reliably
    • This rules out general network or proxy issues (I am accessing from mainland China via proxy)

    As a paying subscriber, I would appreciate transparency on whether this is a known capacity issue and if there are plans to scale qwen3.7 resources. Thanks.

  3. github-actions commented on Aug 24, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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