[BUG] --resume crashes with JSON Parse error when session contains Agent Teams artifacts (queue-operation, SendMessage, Agent)

Resolved 💬 5 comments Opened Mar 24, 2026 by wgordon17 Closed Apr 22, 2026

Bug Description

claude --resume <session-id> crashes with a JSON Parse error when the session JSONL file contains Agent Teams artifacts (queue-operation entries, SendMessage tool calls, Agent tool calls with team tasks).

Error Message

ERROR  JSON Parse error: Unexpected identifier "Error"

 -     at <parse> (:0)
 -     at parse (unknown)
 - lT (/$bunfs/root/src/entrypoints/cli.js:11:54335)
 - fZR (/$bunfs/root/src/entrypoints/cli.js:3231:569)
 - MA (/$bunfs/root/src/entrypoints/cli.js:680:20992)
 - z5 (/$bunfs/root/src/entrypoints/cli.js:680:39537)
 - w7 (/$bunfs/root/src/entrypoints/cli.js:680:50227)
 - KUT (/$bunfs/root/src/entrypoints/cli.js:680:86958)
 - nt_ (/$bunfs/root/src/entrypoints/cli.js:680:85919)
 - dn (/$bunfs/root/src/entrypoints/cli.js:680:85740)
 - dv_ (/$bunfs/root/src/entrypoints/cli.js:680:82483)
 - async <anonymous> (/$bunfs/root/src/entrypoints/cli.js:15525:306)

Steps to Reproduce

  1. Run a session with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 that uses Agent Teams features (Agent tool with team tasks, SendMessage, TaskOutput)
  2. Exit the session normally
  3. Attempt to resume: claude --resume <session-id>
  4. CLI crashes with the above error

Root Cause Analysis

The session JSONL file is valid JSON — every line parses correctly with jq. The crash occurs at runtime during session resume, not from malformed data.

The session contained:

  • 4 queue-operation entries (completed agent task notifications with large result payloads)
  • SendMessage tool_use/tool_result pairs referencing agent task IDs
  • Agent tool_use/tool_result pairs for team tasks
  • TaskOutput tool_use/tool_result pairs where the tasks no longer exist (returning "No task found with ID: ..." errors)

During resume, the CLI appears to try reconnecting to or replaying these agent task references. When the tasks no longer exist, it receives an error string (starting with "Error") where it expects JSON, and JSON.parse() fails.

Workaround

Manually cleaning the session JSONL file by removing agent team artifacts makes the session resumable:

# Backup first
cp session.jsonl session.jsonl.bak

# Remove queue-operation entries and agent team tool calls/results
# (requires identifying the specific tool_use IDs for SendMessage, Agent, TaskOutput calls
# and filtering them plus their corresponding tool_result entries)
jq -c 'select(.type | . != "queue-operation")' session.jsonl.bak > session.jsonl
# Then also filter SendMessage/Agent/TaskOutput tool_use and tool_result blocks from message content arrays

Environment

  • CLI Version: 2.1.80
  • Platform: macOS (Darwin 25.3.0, Apple Silicon)
  • Shell: fish
  • Session size: 1,379 JSONL entries, 4.1MB

Related Issues

  • #36196 — SendMessage tool not exposed to Claude, breaks agent resume (since 2.1.77)
  • #32246 — "Failed to load session" crash with queue-operation flooding
  • #34668 — Agent Teams teammates stop receiving SendMessage after extended polling

View original on GitHub ↗

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