Resume crash: Cannot read properties of null (reading 'split') in diff renderer when conversation contains file creation results
Bug Report
Version: 2.1.63
Platform: Linux (WSL2)
Description
Resuming conversations that contain file-creation tool results causes an immediate crash:
ERROR Cannot read properties of null (reading 'split')
- Object.O6q (cli.js:2801:1935)
- mv4 (cli.js:2431:6759)
- sY / f5 / Xn / v_ / $q / cK / PZ / M1 (cli.js:290:...)
Root Cause
The diff renderer O6q destructures { filePath, structuredPatch, originalFile } from a tool result and immediately calls originalFile.split(...) without a null check:
function O6q({filePath:A, structuredPatch:q, originalFile:K}, ...) {
let _ = A.startsWith(kP());
return createElement(dV1, {firstLine: K.split(...) // crashes when K is null
When a new file is created (Write tool), toolUseResult is stored in the session .jsonl with "originalFile": null — there is no original content. This is valid and expected, but O6q does not guard against it.
{
"type": "user",
"toolUseResult": {
"type": "create",
"filePath": "/some/new/file.cs",
"content": "...",
"structuredPatch": [...],
"originalFile": null
}
}
Impact
- Any conversation that involved creating a new file becomes permanently unresumable
- The bug accumulates — every conversation with file creation is affected
- Error appears immediately when opening the conversation from the resume list
Workaround
Patch affected .jsonl files in ~/.claude/projects/ replacing "originalFile":null with "originalFile":"" in toolUseResult records (empty string is semantically correct for new files and safe for .split()).
Fix Suggestion
In O6q, null-coalesce originalFile before calling .split():
function O6q({filePath:A, structuredPatch:q, originalFile:K}, ...) {
const safeOriginal = K ?? ''; // null for new file creations
return createElement(dV1, {firstLine: safeOriginal.split(...)This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗