Skip to content

Intermittent API Error: Model stream ended without a finish reason (transient empty stream) #2064

@yiliang114

Description

@yiliang114

What happened?

Image

Intermittently, the model stream returns an abnormal response (HTTP 200 but effectively empty), and Qwen Code fails with:
API Error: Model stream ended without a finish reason.

Logs:

Image

Observations:

  • hasFinishReason=false
  • contentTextLength=0
  • hasUsageMetadata=true
  • response_id=""
  • very small output_token_count (e.g. 3)

A related log may also appear:
[CHAT_RECORDING] Error saving assistant turn: Error: partOrString cannot be an empty array

This error interrupts ongoing automated execution in Qwen Code.

What did you expect to happen?

When this transient empty-stream condition happens, Qwen Code should automatically retry and recover whenever possible, instead of failing. From practical usage, retrying shortly after often succeeds.

Client information

  • Qwen Code: 0.11.0 (a31cf757)
  • Runtime: Node.js v22.22.0 / npm 10.9.4
  • IDE client: VS Code
  • Model: bailian/glm-5
  • Session ID: a61da563-3974-478a-9518-2ec6cd2b9c5f
  • Proxy: no proxy
  • Memory: 261.2 MB

Anything else we need to know?

The issue is intermittent, but once it happens it can break long-running automated analysis/tool-use flows. Manual retry after a short wait often succeeds, which suggests a transient upstream stream anomaly rather than a deterministic prompt/content failure.

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