Skip to content

Agent stops mid-session with cryptic, unactionable error message #2870

@maxcleme

Description

@maxcleme

Description

During an active session with docker-agent, the agent abruptly stopped working and surfaced the following error:

model failed: error receiving from stream: POST
"https://<some_anthropic_url>": 200
{"type":"error","error":{"details":null,"type":"api_error","message":"Internal server error"},"request_id":"req_011CbGmqCSWRFpNGGCjrxooP"}

As an end user, this is a dead end: there's no indication of what went wrong, whether it's transient, or what to do next.

Expected Behavior

When the model service is temporarily unreachable or returns an error, the agent should:

  1. Attempt a retry (if the failure looks transient, as an Internal server error typically is)
  2. Show a human-readable error if retries are exhausted, e.g.:

    "We couldn't reach the Anthropic service. Please try again in a moment."

Actual Behavior

The raw internal error is bubbled up as-is. The session dies with no recovery path and no useful guidance for the user.

Why This Matters

A 200 response with an error payload in the body is normal SSE behavior — it's a transient upstream failure, not a client bug. Users should never have to interpret or act on this kind of message. Wrapping it with a friendly, actionable error (and ideally a retry) would make the failure graceful rather than a session-killer.

Suggested Fix

  • Catch type: "error" events in the SSE stream handler
  • Retry the request automatically on api_error (with a short backoff)
  • If retries fail, display a friendly message instead of the raw error payload

Metadata

Metadata

Assignees

Labels

area/agentFor work that has to do with the general agent loop/agentic features of the apparea/providers/anthropicFor features/issues/fixes related to the usage of Anthropic modelskind/fixPR fixes a bug (maps to fix: commit prefix)

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions