REPL crashes with unhandled TypeError when Write tool receives a \?\ long-path prefix on Windows

Resolved 💬 1 comment Opened May 15, 2026 by Little-Bunny-FuFu Closed Jun 13, 2026

Summary

On Windows, invoking the Write tool with a path that starts with the long-path
prefix \?\ (and likely \?\UNC\ / \.\) crashes the REPL with an unhandled
TypeError from the URL constructor. The error escapes the React error
boundary and unmounts the REPL.

The crash happens during tool result rendering — before any PreToolUse hook
runs and before the actual write attempt — so it cannot be prevented by
hooks, and it occurs even for paths that would have been denied or that the
filesystem would have rejected.

Reproducer

On Windows, in any session, invoke:

Write file_path="\?\C:\some\path.txt" content="anything"

(The path doesn't need to be writable — the crash is in the rendering layer.)

Expected

The path is either accepted, denied via permission, or surfaced as a
"would-write" preview — the session continues.

Actual

REPL unmounts. From ~/.claude/debug/<session>.txt:

[ERROR] [reportRenderError] React boundary caught
TypeError: "file://%3F\C:\Users\<user>\.claude\logs\test.log" cannot be parsed as a URL.
[DEBUG] Full reset (shrink->below): prevHeight=528, nextHeight=14, viewport=52
[DEBUG] [REPL:unmount] REPL unmounting

Likely cause

Looks like the tool-result preview tries to render file_path as a clickable
file:// URL via new URL('file://' + encodeURIComponent(path)). The ? in
the long-path prefix encodes to %3F, producing file://%3F\C:\... which is
not a valid URL — the constructor throws, and nothing catches it before the
React error boundary unmounts the REPL.

Environment

  • Claude Code: 2.1.142.41c (cli entrypoint)
  • OS: Windows 11 Pro 26200
  • Node: v24.3.0

Suggested fix

Either skip the URL conversion when the path string contains characters that
make it an invalid URL, or wrap the URL constructor in a try/catch and fall
back to plain-text rendering.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗