[BUG] "JSON Parse error: Unexpected EOF" discards turns mid-stream — regression between 2.1.146 and 2.1.149

Status Open
Reported on v2.1.146
Maintainer reply None cached
Activity 2 comments · opened Aug 31, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Turns fail with API Error: JSON Parse error: Unexpected EOF. The request reaches the
API and starts streaming — a real requestId is assigned and partial content is written
to the transcript — then the turn dies and all of its work is discarded.

No 4xx/5xx is ever logged, so this is not a server-side failure. The error string is
JavaScriptCore phrasing (Node/V8 would say "Unexpected end of JSON input"), so the
failing JSON.parse is inside the Bun-built CLI binary — consistent with a truncated or
malformed SSE data: line.

127 unique occurrences (deduplicated by requestId) across 53 distinct days,
2026-06-01 to 2026-08-31. Currently ~12/day. Losses per event range from a few seconds
to 1186s — about 20 minutes of work gone in a single failure.

What Should Happen?

A malformed SSE frame should be retried, or at minimum surfaced as a recoverable error
that preserves the turn — rather than discarding up to 20 minutes of completed work.

Error Messages/Logs

%LOCALAPPDATA%\Claude\Logs\main.log

[warn] [CCD CycleHealth] local_<id> api_error (success): API Error: JSON Parse error: Unexpected EOF
[info] [CCD CycleHealth] unhealthy cycle for local_<id> (1186s, hadFirstResponse=true, reason=api_error)

Note hadFirstResponse=true — streaming had already begun.

Transcript record: "error":"unknown", "isApiErrorMessage":true, a valid requestId,
"model":"<synthetic>".

Observed wasted cycle durations:
0s, 27s, 62s, 78s, 122s, 241s, 289s, 704s, 834s, 961s, 1131s, 1186s

Steps to Reproduce

Not deterministically reproducible. It surfaces on its own during normal use, typically
several minutes into a turn.

Conditions where it appears here:

  1. Windows 11, Claude Desktop, 4-7 concurrent CLI sessions on the machine.
  2. Work normally for a few minutes.
  3. The turn dies with the error above; frequency is currently ~12/day.

It is NOT correlated with context size: failures occur at 81K and at 803K input tokens
alike, while 97.4% of 14,300 successful turns fall in that same range.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.146

Claude Code Version

2.1.247

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Other

Additional Information

Platform note: Claude subscription (not a pay-as-you-go API key), routed through
api.anthropic.com. Not Bedrock, not Vertex.

Environment note: run from the Claude Desktop app on Windows (entrypoint
"claude-desktop"), not from a terminal emulator — hence "Other" above.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗