TypeError when resuming session: Cannot read properties of undefined (reading 'trim')
Resolved 💬 4 comments Opened Jun 1, 2026 by fartzy Closed Jul 9, 2026
Bug Description
When attempting to resume a specific session, Claude Code CLI crashes with a TypeError.
Command Run
claude --resume 54f512c7-098a-46f7-989d-60fedb59bbd2
Error Output
TypeError: Cannot read properties of undefined (reading 'trim')
at bz5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2143:3374)
at G$ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:73:19415)
at ka (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:42814)
at S9 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:38355)
at Wm (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:38283)
at z$ (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:38137)
at WC (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:35216)
at H4 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:73:4841)
at h5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:75:32461)
at Q.updateContainer (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:79:1827)
Additional Context
- The session file exists at:
~/.claude/projects/-Users-michael-artz-dev-asset-management/54f512c7-098a-46f7-989d-60fedb59bbd2.jsonl - The session file is 438 lines long and appears to be valid JSONL
- The session ended with repeated API 404 errors for model
claude-3-5-haiku-20241022 - Running
claude sessions listalso times out (after 2+ minutes) - The session file contains entries with empty/undefined text fields in some message objects
Observations
The error suggests the CLI is trying to call .trim() on an undefined value when parsing the session file. This may be related to:
- Sessions that ended with API errors
- Message entries with missing or undefined text fields
- Corrupted session state from incomplete API responses
Environment
- Platform: macOS (darwin)
- Installation: Homebrew (
/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/)
Reporter Info
GitHub: @fartzy
Email: fartzy@hotmail.com
Workaround
The session data was successfully recovered by manually parsing the JSONL file with Node.js.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗