Bug Report: FileHistory causes memory exhaustion and crash...

Resolved 💬 3 comments Opened Oct 19, 2025 by samuelho-dev Closed Oct 22, 2025

Bug Description
Bug Report: FileHistory causes memory exhaustion and crash on /resume

SEVERITY: High - Claude Code crashes with trace trap, loses session data

ISSUE:
When running /resume, Claude Code crashes with "trace trap" error, making it impossible to restore previous sessions.

ROOT CAUSE ANALYSIS:
FileHistory feature has a bug where it continues tracking deleted files indefinitely. For each snapshot (created on every message), it logs "Missing tracked
file:" warnings for all previously tracked but now-deleted files.

REPRODUCTION:

  1. Start a Claude Code session
  2. Create/delete files during the session (e.g., documentation files, test files)
  3. Continue working - each message creates a new snapshot
  4. FileHistory keeps logging missing files → session file grows exponentially
  5. Exit and try to /resume → crashes with trace trap

MY CASE STATS:

  • Session file size: 2.4 GB (should be ~100KB)
  • Debug log: 503 MB
  • Total messages: 118,110
  • Snapshots created: 111,333
  • "Missing tracked file" warnings: 4,784,036
  • Deleted files still being tracked: 43

EXPECTED BEHAVIOR:

  1. FileHistory should stop tracking files after deletion
  2. Session files should remain <10MB even for long sessions
  3. /resume should load sessions gracefully, even if large

ACTUAL BEHAVIOR:
Session file grows to 2.4GB, becomes unloadable, causes trace trap crash on /resume attempt

WORKAROUND USED:
Manually moved corrupted session from ~/.claude/projects/-Users-x-Projects-x/ to backup location

SUGGESTED FIXES:

  1. Stop tracking deleted files in FileHistory
  2. Add max snapshot count/age limits
  3. Implement session file size guardrails
  4. Add streaming/pagination for large session loads
  5. Graceful degradation instead of crash

VERSION: Claude Code v2.0.22
OS: macOS Darwin 25.0.0
Installation: native

Environment Info

  • Platform: darwin
  • Terminal: tmux
  • Version: 2.0.22
  • Feedback ID: 9f3eaa2c-70e0-40ef-b3d4-861b40bdb977

Errors

[{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"},\"request_id\":\"req_011CUFz6uK19rkD5py5EE7VG\"}\n    at generate (/$bunfs/root/claude:200:83061)\n    at makeRequest (/$bunfs/root/claude:354:5345)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-10-19T05:13:29.359Z"},{"error":"SyntaxError: JSON Parse error: Expected '}'\n    at <parse> (:0)\n    at parse (unknown)\n    at <anonymous> (/$bunfs/root/claude:65:724)\n    at Y (/$bunfs/root/claude:11:15050)\n    at huG (/$bunfs/root/claude:1006:20574)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-10-19T05:13:29.360Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"},\"request_id\":\"req_011CUFzCwmFr9CZJatuSx5vA\"}\n    at generate (/$bunfs/root/claude:200:83061)\n    at makeRequest (/$bunfs/root/claude:354:5345)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-10-19T05:14:51.338Z"},{"error":"SyntaxError: JSON Parse error: Expected '}'\n    at <parse> (:0)\n    at parse (unknown)\n    at <anonymous> (/$bunfs/root/claude:65:724)\n    at Y (/$bunfs/root/claude:11:15050)\n    at huG (/$bunfs/root/claude:1006:20574)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-10-19T05:14:51.340Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"},\"request_id\":\"req_011CUFzLEdDeTdSYYkk8uG4R\"}\n    at generate (/$bunfs/root/claude:200:83061)\n    at makeRequest (/$bunfs/root/claude:354:5345)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-10-19T05:16:30.238Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"},\"request_id\":\"req_011CUFzLEfwrPCmWatrTvHRa\"}\n    at generate (/$bunfs/root/claude:200:83061)\n    at makeRequest (/$bunfs/root/claude:354:5345)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-10-19T05:16:30.261Z"},{"error":"Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"OAuth authentication is currently not supported.\"},\"request_id\":\"req_011CUFzLLSDFcYw75MUbhqBY\"}\n    at generate (/$bunfs/root/claude:200:83061)\n    at makeRequest (/$bunfs/root/claude:354:5345)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-10-19T05:16:31.608Z"},{"error":"Error: 401 {\"type\":\"erro

Note: Error logs were truncated.

View original on GitHub ↗

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