Crash When Attempting Empty File Write
Resolved 💬 10 comments Opened Jun 23, 2025 by charlotte-zhuang Closed Jun 25, 2025
Bug Description
when claude-code tries to create an empty file, it crashes.
steps to reproduce: ask claude to create an empty file
error
> i think you have a bug in your system. can you help me isolate the issue by creating
an empty file called test.txt at the root of cwd?
✻ Thinking…
The user is asking me to create an empty file called test.txt at the root of the
current working directory to help isolate a bug. This is a straightforward request
for troubleshooting purposes. I should use the Write tool to create an empty file at
the path test.txt.
⏺ Write(test.txt)
╭──────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ Opened changes in Visual Studio Code ⧉ │
│ Save file to continue… │
│ │
│ Do you want to make this edit to test.txt? │
│ ❯ 1. Yes │
│ 2. Yes, and don't ask again this session (shift+tab) │
│ 3. No, and tell Claude what to do differently (esc) │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────╯
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
Error: String not found in file. Failed to apply edit.
at gO (file:///Users/charlotte.zhuang/.nvm/versions/node/v20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1720:546)
at nF5 (file:///Users/charlotte.zhuang/.nvm/versions/node/v20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1979:9834)
at F (file:///Users/charlotte.zhuang/.nvm/versions/node/v20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1979:8812)
at file:///Users/charlotte.zhuang/.nvm/versions/node/v20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:1979:9078
at GI (file:///Users/charlotte.zhuang/.nvm/versions/node/v20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:21374)
at VY (file:///Users/charlotte.zhuang/.nvm/versions/node/v20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:40861)
at file:///Users/charlotte.zhuang/.nvm/versions/node/v20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:82:39057
at vP1 (file:///Users/charlotte.zhuang/.nvm/versions/node/v20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:76:79278)
at Immediate.SP1 [as _onImmediate] (file:///Users/charlotte.zhuang/.nvm/versions/node/v20.11.0/lib/node_modules/@anthropic-ai/claude-code/cli.js:76:79696)
at process.processImmediate (node:internal/timers:478:21)
Node.js v20.11.0
Environment Info
- Platform: darwin
- Terminal: vscode
- Version: 1.0.31
- Feedback ID: 8e687528-2465-44a6-8ef4-fccaecca276b
Errors
Note: Error logs were truncated.
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗