claude-code - 💡(How to fix) Fix [BUG] claude --resume crashes with null is not an object (evaluating 'A.split') [1 comments, 2 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#48682Fetched 2026-04-16 06:53:50
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

ERROR null is not an object (evaluating 'A.split') /$bunfs/root/claude:2725:1261

Stack trace points to VkB function:

  • VkB (/$bunfs/root/claude:2725:1261)
  • D2B (/$bunfs/root/claude:2355:4368)

Root Cause

In the VkB renderer (/$bunfs/root/claude:2725), the originalFile parameter A is null, but the code calls A.split('\n') without a null check:

VkB({ filePath: T, structuredPatch: R, originalFile: A }, _, { style: B, verbose: D }) {
    return m4.createElement(HyR, {
        firstLine: A.split('\n')[0] ?? null,  // ← crashes when A is null
        fileContent: A,
        ...
    })
}

Fix Action

Fix / Workaround

VkB({ filePath: T, structuredPatch: R, originalFile: A }, _, { style: B, verbose: D }) {
    return m4.createElement(HyR, {
        firstLine: A.split('\n')[0] ?? null,  // ← crashes when A is null
        fileContent: A,
        ...
    })
}

Code Example

ERROR  null is not an object (evaluating 'A.split')
/$bunfs/root/claude:2725:1261

---

- VkB (/$bunfs/root/claude:2725:1261)
- D2B (/$bunfs/root/claude:2355:4368)

---

VkB({ filePath: T, structuredPatch: R, originalFile: A }, _, { style: B, verbose: D }) {
    return m4.createElement(HyR, {
        firstLine: A.split('\n')[0] ?? null,  // ← crashes when A is null
        fileContent: A,
        ...
    })
}

---

{
  "type": "file-history-snapshot",
  "snapshot": {
    "trackedFileBackups": {
      "src/agents/autopilot_manager.py": {
        "backupFileName": null,
        "version": 1,
        "backupTime": "2026-04-14T08:10:25.445Z"
      }
    }
  }
}

---

{
  "type": "file-history-snapshot",
  "snapshot": {
    "trackedFileBackups": {
      "src/agents/autopilot_manager.py": {
        "backupFileName": null,
        "version": 1,
        "backupTime": "2026-04-14T08:10:25.445Z"
      }
    }
  }
}

---

### Error Message

ERROR  null is not an object (evaluating 'A.split')
/$bunfs/root/claude:2725:1261


Stack trace points to `VkB` function:

- VkB (/$bunfs/root/claude:2725:1261)
- D2B (/$bunfs/root/claude:2355:4368)

---

firstLine: A?.split('\n')[0] ?? null
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Error Message

ERROR  null is not an object (evaluating 'A.split')
/$bunfs/root/claude:2725:1261

Stack trace points to VkB function:

- VkB (/$bunfs/root/claude:2725:1261)
- D2B (/$bunfs/root/claude:2355:4368)

Root Cause

In the VkB renderer (/$bunfs/root/claude:2725), the originalFile parameter A is null, but the code calls A.split('\n') without a null check:

VkB({ filePath: T, structuredPatch: R, originalFile: A }, _, { style: B, verbose: D }) {
    return m4.createElement(HyR, {
        firstLine: A.split('\n')[0] ?? null,  // ← crashes when A is null
        fileContent: A,
        ...
    })
}

Triggering Input

The crash is triggered when resuming a session that contains a file-history-snapshot entry where a tracked file's backupFileName is null:

{
  "type": "file-history-snapshot",
  "snapshot": {
    "trackedFileBackups": {
      "src/agents/autopilot_manager.py": {
        "backupFileName": null,
        "version": 1,
        "backupTime": "2026-04-14T08:10:25.445Z"
      }
    }
  }
}

This happens for newly created files that have not yet been backed up (version 1, no prior backup). When --resume renders the diff for this file, originalFile is null because there is no backup to read from, and the renderer does not handle this case.

What Should Happen?

Triggering Input

The crash is triggered when resuming a session that contains a file-history-snapshot entry where a tracked file's backupFileName is null:

{
  "type": "file-history-snapshot",
  "snapshot": {
    "trackedFileBackups": {
      "src/agents/autopilot_manager.py": {
        "backupFileName": null,
        "version": 1,
        "backupTime": "2026-04-14T08:10:25.445Z"
      }
    }
  }
}

This happens for newly created files that have not yet been backed up (version 1, no prior backup). When --resume renders the diff for this file, originalFile is null because there is no backup to read from, and the renderer does not handle this case.

Error Messages/Logs

### Error Message

ERROR  null is not an object (evaluating 'A.split')
/$bunfs/root/claude:2725:1261


Stack trace points to `VkB` function:

- VkB (/$bunfs/root/claude:2725:1261)
- D2B (/$bunfs/root/claude:2355:4368)

Steps to Reproduce

Steps to Reproduce

  1. Start a Claude Code session in a project
  2. Have Claude create a brand-new file (never existed before) — this produces a file-history-snapshot entry with backupFileName: null
  3. Exit the session
  4. Run claude --resume <session-id>
  5. → Crash immediately

Expected Behavior

originalFile being null should be handled gracefully, e.g.:

firstLine: A?.split('\n')[0] ?? null

Environment

  • Claude Code version: 2.1.63
  • Installed via: Homebrew
  • OS: macOS

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.63

Platform

Other

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

extent analysis

TL;DR

The crash can be fixed by adding a null check for the originalFile parameter A in the VkB renderer.

Guidance

  • The issue arises from the VkB function not handling the case where originalFile is null, which occurs when a new file is created and has no backup.
  • To fix this, add a null check for A before calling A.split('\n'), such as using the optional chaining operator ?. as suggested in the expected behavior.
  • Verify the fix by resuming a session with a file-history-snapshot entry containing a null backupFileName and checking that the crash no longer occurs.
  • Consider adding additional error handling or logging to handle other potential cases where originalFile might be null or undefined.

Example

VkB({ filePath: T, structuredPatch: R, originalFile: A }, _, { style: B, verbose: D }) {
    return m4.createElement(HyR, {
        firstLine: A?.split('\n')[0] ?? null, 
        fileContent: A,
        ...
    })
}

Notes

This fix assumes that the desired behavior when originalFile is null is to simply return null for firstLine. Depending on the specific requirements of the application, additional handling may be necessary.

Recommendation

Apply the workaround by adding a null check for originalFile in the VkB renderer, as this is a regression introduced in a recent version and the previous behavior is desired.

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