[BUG] TUI crashes on `constructor.hpp` with `(r||"").toLowerCase is not a function`
Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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's TUI crashes when it tries to create, write, or edit a file named constructor.hpp.
At first this looked workspace-specific, because I first encountered it in a few repositories. After further testing, I was able to narrow it down much more:
- Files such as
constructor2.hpp,constructor_copy.hpp, andtmp.hppdo not trigger the crash - A file named
constructor.hppdoes trigger the crash - This reproduces in different environments, not just one local workspace
- The problem appears tied to the filename and the write/edit path in the TUI, rather than to the original repository contents
I can reproduce this even with a minimal file named constructor.hpp.
What Should Happen?
Claude Code should be able to create, write, and edit a file named constructor.hpp without crashing the TUI.
Error Messages/Logs
The key error at the beginning is:
```text id="1pab8y"
ERROR (r||"").toLowerCase is not a function. (In '(r||"").toLowerCase()', '(r||"").toLowerCase' is undefined)
/$bunfs/root/src/entrypoints/cli.js:1438:2089
Part of the stack trace near the end:
```text id="2m2jj0"
- g (/$bunfs/root/src/entrypoints/cli.js:1438:2089)
- nGK (/$bunfs/root/src/entrypoints/cli.js:1717:10107)
- render (/$bunfs/root/src/entrypoints/cli.js:1719:2254)
- Qz1 (/$bunfs/root/src/entrypoints/cli.js:1722:1456)
- <anonymous> (/$bunfs/root/src/entrypoints/cli.js:1722:2115)
- $D (/$bunfs/root/src/entrypoints/cli.js:452:20997)
- _z (/$bunfs/root/src/entrypoints/cli.js:452:39538)
- UH (/$bunfs/root/src/entrypoints/cli.js:452:36907)
- xH (/$bunfs/root/src/entrypoints/cli.js:452:36434)
- Hs (/$bunfs/root/src/entrypoints/cli.js:452:52627)
Steps to Reproduce
Minimal reproduction pattern:
- Start Claude Code in a fresh folder or fresh session.
- Ask Claude Code to create a file named
constructor.hpp. - Use minimal contents such as:
```cpp id="q3sd9a"
#pragma once
struct A {};
4. The TUI crashes during the write step.
I can also reproduce the crash when editing a file named `constructor.hpp`.
Control cases that do **not** crash:
1. Create or edit `constructor2.hpp` with the same minimal contents.
2. Create or edit `constructor_copy.hpp` with the same minimal contents.
3. Create or edit `tmp.hpp` with the same minimal contents.
These control cases work normally, which makes me suspect this is specifically related to the filename `constructor.hpp`.
### Claude Model
Opus
### Is this a regression?
Yes, this worked in a previous version.
### Last Working Version
*No response*
### Claude Code Version
2.1.87 (Claude Code)
### Platform
Anthropic API
### Operating System
Windows and Linux
### Terminal/Shell
WSL on Windows locally, and also reproduced in a separate Linux server environment
### Additional Information
Additional narrowing I did:
* Initially this looked repository-specific
* Moving the project to a new directory did not help
* Clearing caches did not help
* Deleting Claude Code's local project state did not help
* I checked for encoding issues, suspicious characters, BOM, zero-width characters, bidi control characters, and similar issues across the codebase and did not find anything
* I tested copies of the original file under different names, and those did not crash
* I tested the same filename in a different directory, and it still crashed
* I tested a minimal `constructor.hpp` file, and it still crashed
At this point, the issue seems strongly tied to the filename `constructor.hpp` during the TUI write/edit flow, rather than to file contents, encoding, inode identity, or a specific repository.
If helpful, I can provide more step-by-step reproduction notes.This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗