claude-code - 💡(How to fix) Fix Resume crash: Cannot read properties of null (reading 'split') in diff renderer when conversation contains file creation results [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#55162Fetched 2026-05-01 05:44:38
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
0
Timeline (top)
labeled ×4commented ×2closed ×1cross-referenced ×1

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:...)

Error Message

ERROR Cannot read properties of null (reading 'split')

  • Error appears immediately when opening the conversation from the resume list

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
  }
}

Fix Action

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()).

Code Example

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:...)

---

function O6q({filePath:A, structuredPatch:q, originalFile:K}, ...) {
  let _ = A.startsWith(kP());
  return createElement(dV1, {firstLine: K.split(...)  // crashes when K is null

---

{
  "type": "user",
  "toolUseResult": {
    "type": "create",
    "filePath": "/some/new/file.cs",
    "content": "...",
    "structuredPatch": [...],
    "originalFile": null
  }
}

---

function O6q({filePath:A, structuredPatch:q, originalFile:K}, ...) {
  const safeOriginal = K ?? '';  // null for new file creations
  return createElement(dV1, {firstLine: safeOriginal.split(...)
RAW_BUFFERClick to expand / collapse

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(...)

extent analysis

TL;DR

The most likely fix is to null-coalesce the originalFile variable in the O6q function to prevent calling split() on null.

Guidance

  • Verify the issue by checking if the error occurs when resuming conversations that contain file-creation tool results.
  • Apply the suggested fix by modifying the O6q function to null-coalesce the originalFile variable.
  • As a temporary workaround, patch affected .jsonl files in ~/.claude/projects/ by replacing "originalFile":null with "originalFile":"" in toolUseResult records.
  • Test the fix by resuming a conversation that previously caused the crash and verify that it no longer occurs.

Example

function O6q({filePath:A, structuredPatch:q, originalFile:K}, ...) {
  const safeOriginal = K ?? '';  // null for new file creations
  return createElement(dV1, {firstLine: safeOriginal.split(...)
}

Notes

This fix assumes that an empty string is a semantically correct replacement for null when a new file is created. If this is not the case, further modifications may be necessary.

Recommendation

Apply the workaround by patching the affected .jsonl files, as this provides a temporary solution until the fix can be implemented and verified.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING