Skip to content

[Stream Error] DeepSeek v4.1 Flash drops mid-stream after ~3.5 min: {"type":"server_error","message":"Network connection lost."} #1124

Open

Description

@alwaghani

Summary

When using deepseek/deepseek-v4.1-flash on the /alpha/generate streaming endpoint, long-running requests (e.g. multi-turn tool calling with reasoning) can hang for ~3.5 minutes (208,974 ms) and then abruptly terminate with a mid-stream error event:

{"type":"error","error":{"type":"server_error","message":"Network connection lost."}}

Steps to Reproduce

  1. Start a coding session generating a complex response or multi-turn tool execution with deepseek/deepseek-v4.1-flash.
  2. Keep the stream connection open while the model reasons/generates tokens.
  3. After ~3.5 minutes (observed at ~209s), the stream receives:
    {"type":"error","error":{"type":"server_error","message":"Network connection lost."}}

Observed Log Trace

[18:11:55] POST .../alpha/generate -> stream started
[18:15:24] ✗ ERROR: [CommandCode error: {"type":"server_error","message":"Network connection lost."}] (duration: 208974ms)

Expected Behavior

  • The upstream connection between CommandCode's gateway and the DeepSeek backend cluster should maintain keep-alive/heartbeat or handle transient drops gracefully instead of terminating with server_error: Network connection lost. after 3.5 minutes.
  • If an upstream drop occurs, provide retryable metadata or connection recovery.

Environment

  • CLI / Wire Protocol: 1.88.5
  • Model: deepseek/deepseek-v4.1-flash
  • OS: Linux x64

Activity

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