[BUG] Crashes with TypeError: undefined is not an object (evaluating 'filePath.startsWith')

Resolved 💬 2 comments Opened Jan 19, 2026 by ghost Closed Jan 19, 2026

This issue report was generated with the assistance of an AI.

Preflight Checklist

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

What's Wrong?

Claude Code crashes during tool result rendering with a runtime exception:

TypeError: undefined is not an object (evaluating 'H.startsWith')

The error occurs inside the UI renderer when handling a tool result where filePath is unexpectedly undefined. The code assumes filePath is always a string and calls .startsWith() without a guard, causing a hard crash.

This happens while Claude is actively processing output (e.g. file edits / patches), not due to user code.

What Should Happen?

Claude Code should safely handle tool results that do not include a filePath value.

Specifically:

Renderer should not crash if filePath is undefined

A defensive check should be applied before calling .startsWith()

The session should continue normally instead of terminating

Error Messages/Logs

TypeError: undefined is not an object (evaluating 'H.startsWith')
    at jrD (B:/~BUN/root/claude.exe:2282:1159)
    at IAI (B:/~BUN/root/claude.exe:2639:4394)
    at EU (B:/~BUN/root/claude.exe:678:20694)
    at DV (B:/~BUN/root/claude.exe:678:39063)
    at zb (B:/~BUN/root/claude.exe:678:49673)
    at GU (B:/~BUN/root/claude.exe:678:85821)
    at $v (B:/~BUN/root/claude.exe:678:84801)
    at Yz (B:/~BUN/root/claude.exe:678:84626)
    at hb (B:/~BUN/root/claude.exe:678:81443)
    at RA (B:/~BUN/root/claude.exe:678:6240)

Bun v1.3.5 (Windows x64 baseline)

Steps to Reproduce

Steps to Reproduce

Run Claude Code on Windows using Bun runtime

Trigger an operation where Claude performs file edits or patch rendering

Claude produces a tool result / structured patch without a filePath

Renderer attempts to evaluate:

``` js
filePath.startsWith(...)


Claude crashes with TypeError: undefined is not an object

This appears to happen intermittently depending on tool output shape.

### Claude Model

Opus

### Is this a regression?

I don't know

### Last Working Version

_No response_

### Claude Code Version

2.1.6 (Claude Code)

### Platform

Anthropic API

### Operating System

Windows

### Terminal/Shell

Windows Terminal

### Additional Information

The crash occurs due to missing null-safety in the renderer:

``` js
let f = H.startsWith(LJ())

Suggested fix:

``` js
const f = typeof H === "string" && H.startsWith(LJ())



This is a defensive programming issue. Claude Code should not assume tool outputs always contain filePath, especially in a tool-driven architecture.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗