/resume command consistently crashing after the agent reads too big files, resulting in full unavailability of command and conversation history until fixed

Status Closed — not planned
Reported on v2.0.76
Maintainer reply None cached
Activity 4 comments · opened Jan 4, 2026 · closed Mar 6, 2026

Environment Info

  • Platform: win32
  • Terminal: pycharm
  • Version: 2.0.76
  • Feedback ID: 9c2b73a1-75e6-464b-a7a3-84371b49b915
  • Claude Code Version: 2.0.76
  • Platform: Windows (win32)
  • Affected Project: E:\PYPY\UI-UX
  • Date Issue First Observed: January 4, 2026
  • Files Created: January 3, 2026

Summary

The /resume command crashes when loading conversation history that contains extremely large tool result entries (>50KB per JSON line). This occurs specifically in projects where the Read tool has captured large file contents in conversation history.

Environment

  • Claude Code Version: 2.0.76
  • Platform: Windows (win32)
  • Affected Project: E:\PYPY\UI-UX
  • Date Issue First Observed: January 4, 2026
  • Files Created: January 3, 2026

Steps to Reproduce

  1. Work on a project where Read tool captures large files (1000+ lines)
  2. Let these conversations persist in the project history
  3. Switch to a different conversation or restart Claude Code
  4. Attempt to run /resume command in the affected project
  5. Result: Command crashes/fails

Expected Behavior

  • /resume should load and display available conversations
  • Large tool results should be handled gracefully (truncated, paginated, or lazy-loaded)
  • Users should be able to browse and resume any conversation regardless of content size

Actual Behavior

  • /resume command crashes when attempting to parse conversation files
  • No error message is displayed to the user
  • Command works fine in other projects without large tool results
  • Manual removal of problematic files restores /resume functionality

Root Cause Analysis

Technical Details

The crash is caused by individual JSON lines exceeding reasonable parsing limits in conversation history files (.jsonl format).

Problematic Files Identified

Located in: C:\Users\roman\.claude\projects\E--PYPY-UI-UX\

| Filename | Total Size | Problematic Lines | Max Line Size |
|----------|-----------|-------------------|---------------|
| agent-a99a960.jsonl | 508,510 bytes | Line 64, Line 69 | 100,839 bytes |
| agent-a463171.jsonl | 450,814 bytes | Line 21 | 58,454 bytes |
| 51343dd6-60b1-4ace-b51e-b342a40fccd9.jsonl | 3,057,813 bytes | Line 683 | 52,986 bytes |
| agent-a4d1be6.jsonl | 125,047 bytes | Multiple | ~21KB lines |
| agent-a6c089e.jsonl | 222,635 bytes | Multiple | ~34KB lines |

Detailed Analysis of Largest Offender

File: agent-a99a960.jsonl
Line 69: 100,839 bytes (98.5 KB)

{
  "type": "user",
  "message": {
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "tool_use_id": "toolu_017kWqqvwDHxSocjy5iE5gtf",
        "content": "... 52,526 characters of Read tool output (1,020 lines) ..."
      }
    ]
  }
}

Breakdown:

  • Tool result content: 52,526 characters
  • Full JSON line: 100,839 bytes
  • Overhead ratio: 1.92x (due to JSON escaping, metadata, etc.)
  • Content: Read tool output containing 1,020 lines of code

Why This Breaks /resume

  1. Memory Pressure: Loading multiple 50-100KB lines into memory for parsing
  2. JSON Parser Limits: Some JSON parsers have line length limits or buffer constraints
  3. UI Rendering: Attempting to render conversation previews with massive entries
  4. String Processing: Operations on 100KB+ strings can be expensive

Validation Results

✅ All JSON is syntactically valid (no malformed JSON)
✅ No null bytes or corrupted characters
✅ No incomplete lines or truncated data
❌ Individual lines exceed reasonable size expectations

Analysis of agent-a99a960.jsonl:
  Total lines: 70
  JSON validity: All valid
  Lines > 50KB: 2 found
  Lines > 100KB: 1 found
  Content type: tool_result (Read tool outputs)

Impact

Severity: Medium-High

  • Users cannot use /resume in affected projects
  • Workaround requires manual file investigation and deletion
  • Data is not corrupted but functionally inaccessible via normal UI
  • Only affects projects with large file reads in recent history

User Experience Impact

  • Loss of ability to browse conversation history
  • Confusion (no error message explaining the failure)
  • Manual intervention required to restore functionality
  • Risk of accidentally deleting important conversation history

Why Other Projects Are Unaffected

Projects without this issue typically:

  • Have smaller codebases (Read results < 10KB)
  • Have been regularly compacted (removing bloated tool results)
  • Don't have conversations from the specific time period (Jan 3, 2026)
  • Don't use Read tool on large files as frequently

Proposed Solutions

1. Immediate Fix: Tool Result Truncation (Recommended)

When storing tool results in conversation history:

  • Truncate tool_result content to a maximum size (e.g., 10KB)
  • Add metadata indicating truncation: "truncated": true, "original_size": 52526
  • Provide "expand" functionality only when conversation is actively loaded

Benefits:

  • Prevents future occurrences
  • Maintains conversation usability
  • Reduces storage requirements

2. Parser Enhancement: Streaming/Lazy Loading

Modify /resume command to:

  • Stream parse JSONL files instead of loading entire lines
  • Lazy-load conversation previews
  • Skip or summarize large tool_result blocks during listing

Benefits:

  • Handles existing problematic files
  • Better performance overall
  • Future-proof for any large content

3. Hard Limit: Reject Oversized Lines

Add validation when writing conversation history:

  • Reject individual JSON lines > 50KB
  • Log warning and store truncated version
  • Alert user that output was too large to store

Benefits:

  • Simple to implement
  • Clear boundaries
  • Prevents storage bloat

4. Migration Tool: Sanitize Existing Files

Provide utility to:

  • Scan existing conversation files
  • Identify and truncate large tool_result entries
  • Preserve conversation structure and metadata
  • Create backup before modification

Benefits:

  • Fixes existing installations
  • One-time operation
  • User-controlled

Workaround (Current)

For affected users:

# 1. Navigate to project conversation directory
cd "C:\Users\<username>\.claude\projects\<project-hash>"

# 2. Identify problematic files (created on affected dates)
ls -lh *.jsonl | grep "Jan  3"

# 3. Move (don't delete) to backup location
mkdir ../backup
mv agent-a*.jsonl ../backup/
mv <large-conversation-id>.jsonl ../backup/

# 4. Test /resume command
# 5. If working, archive or sanitize backup files

Additional Context

File Structure

C:\Users\roman\.claude\projects\E--PYPY-UI-UX\
├── 51343dd6-60b1-4ace-b51e-b342a40fccd9.jsonl (3MB - contains huge lines)
├── agent-a463171.jsonl (450KB - contains huge lines)
├── agent-a99a960.jsonl (508KB - contains 100KB line)
├── agent-a4d1be6.jsonl (125KB - large)
├── agent-a6c089e.jsonl (222KB - large)
└── [other normal-sized conversation files]

Timeline

  • December 28-29, 2025: Normal usage, some large conversations
  • January 3, 2026: Multiple agent conversations with large Read operations
  • January 4, 2026: /resume command begins failing
  • January 4, 2026: User manually identifies and removes problematic files
  • January 4, 2026: /resume functionality restored after file removal

Reproduction Test Case

To reproduce in a test environment:

# Create a test conversation file with oversized tool_result
import json

large_content = "Line content\n" * 5000  # ~60KB of content

message = {
    "type": "user",
    "message": {
        "role": "user",
        "content": [{
            "type": "tool_result",
            "tool_use_id": "test_id",
            "content": large_content
        }]
    },
    "uuid": "test-uuid",
    "timestamp": "2026-01-04T00:00:00.000Z"
}

# Write to conversation file
with open("test-conversation.jsonl", "w") as f:
    f.write(json.dumps(message) + "\n")

# Attempt to load with /resume parser
# Expected: Crash or hang

Metrics

Size Distribution of Problematic Files:

  • Total problematic conversations: 8 files
  • Total size: ~4.9 MB
  • Average file size: 614 KB
  • Largest single line: 100,839 bytes
  • Normal conversation file size: <50 KB
  • Size increase: ~12-20x larger than typical

Tool Result Size Distribution:

  • Line 69 of agent-a99a960.jsonl: 52,526 chars (1,020 code lines)
  • Line 64 of agent-a99a960.jsonl: 39,132 chars (~780 code lines)
  • Line 21 of agent-a463171.jsonl: 30,217 chars (~600 code lines)
  • Line 683 of 51343dd6-60b1-4ace-b51e-b342a40fccd9.jsonl: 27,628 chars (~550 code lines)

Recommendations

Priority 1: Immediate User Impact

  • Implement tool_result truncation in conversation storage (max 10-20KB)
  • Add user-facing error message when /resume fails
  • Document workaround in user guide

Priority 2: Long-term Robustness

  • Implement streaming parser for JSONL conversation files
  • Add conversation file size monitoring/alerting
  • Create automated cleanup/compaction of old large conversations

Priority 3: Developer Experience

  • Add size limits to tool result storage with clear warnings
  • Provide migration tool for existing installations
  • Add telemetry to track conversation file size distribution

Related Issues

This issue may be related to:

  • Conversation compaction efficiency
  • Tool result storage strategy
  • Memory management in conversation loading
  • JSONL parser implementation details

Testing Checklist

To verify fix:

  • [ ] Create conversation with Read tool on 1000+ line file
  • [ ] Verify tool result is truncated/handled appropriately
  • [ ] Confirm /resume loads successfully with large tool results
  • [ ] Test with multiple large conversations in same project
  • [ ] Verify migration tool handles existing problematic files
  • [ ] Confirm no data loss for important conversation context
  • [ ] Test edge cases (100KB, 500KB, 1MB tool results)
  • [ ] Verify performance with 100+ conversations including large ones

Attachments

Sample problematic files available at:

  • E:\PYPY\Test\files\ (8 files demonstrating the issue)
  • Total size: 4.4 MB
  • All files validated: syntactically correct JSON, logically problematic sizes

View original on GitHub ↗

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