[BUG] TypeError: undefined is not an object (evaluating '_.startsWith') when resuming conversation
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
Resuming a specific conversation via claude --resume <id> crashes immediately with undefined is not an object (evaluating '_.startsWith'). The crash occurs in the diff rendering code (kF7) when the UI tries to re-render a past tool result that has an undefined file_path.
What Should Happen?
The conversation should resume and render past tool results without crashing, even if a file_path field is missing/null in a stored tool result.
Error Messages/Logs
ERROR undefined is not an object (evaluating '_.startsWith')
/$bunfs/root/src/entrypoints/cli.js:3142:1937
- kF7 (/$bunfs/root/src/entrypoints/cli.js:3142:1937)
- EW7 (/$bunfs/root/src/entrypoints/cli.js:2593:44450)
- SA (/$bunfs/root/src/entrypoints/cli.js:675:21000)
- BH (/$bunfs/root/src/entrypoints/cli.js:675:39546)
- G8 (/$bunfs/root/src/entrypoints/cli.js:675:50237)
- Ce_ (/$bunfs/root/src/entrypoints/cli.js:675:86958)
- P3_ (/$bunfs/root/src/entrypoints/cli.js:675:85915)
- Py_ (/$bunfs/root/src/entrypoints/cli.js:675:85736)
- jy_ (/$bunfs/root/src/entrypoints/cli.js:675:82474)
- OT (/$bunfs/root/src/entrypoints/cli.js:675:6372)
Steps to Reproduce
- Have a conversation that contains file edit tool results
- End the conversation
- Resume it with
claude --resume <conversation-id> - CLI crashes immediately during rendering
I haven't been able to identify what's special about this conversation vs. others that resume fine. The conversation likely contains an edit tool result where file_path is undefined/null in the stored state.
Claude Model
Opus
Is this a regression?
I don't know
Claude Code Version
2.1.84 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
Root cause analysis: The crash is in kF7, which destructures {filePath: _} from the tool result and immediately calls _.startsWith(S1()) without a null guard. This function renders structured patches for file diffs. When resuming a conversation, if a stored tool result has an undefined file_path, the renderer crashes instead of gracefully handling the missing field.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗