[Bug] rm -rf command deletes unintended parent directory contents

Resolved 💬 6 comments Opened Jan 27, 2026 by lyt516 Closed Mar 3, 2026

Bug Description
Critical Bug: rm -rf on single subdirectory deleted entire parent directory contents

Date: 2026-01-27
Session ID: 997249f6-0edd-442c-a9ba-25d278244e7e

ISSUE:
Executed: rm -rf ~/claude-mcp/web-crawler-mcp
Expected: Only web-crawler-mcp folder deleted
Actual: Almost ALL contents of ~/claude-mcp/ were deleted

Error shown: "rm: /Users/username/claude-mcp/: Permission denied"
But deletion still happened on unintended directories.

IMPACT:

  • 6 months of project files lost
  • Full day spent on recovery

The command syntax was correct but execution affected wrong scope.
This is a critical data loss bug.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.0.27
  • Feedback ID:

Errors

[{"error":"RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stdout maxBuffer length exceeded\n    at Socket.onChildStdout (node:child_process:482:14)\n    at Socket.emit (node:events:507:28)\n    at Socket.emit (node:domain:489:12)\n    at addChunk (node:internal/streams/readable:559:12)\n    at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)\n    at Readable.push (node:internal/streams/readable:390:5)\n    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)","timestamp":"2026-01-27T12:55:13.105Z"},{"error":"AxiosError: timeout of 5000ms exceeded\n    at UE.<anonymous> (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:29:10428)\n    at UE.emit (node:events:507:28)\n    at UE.emit (node:domain:489:12)\n    at Timeout.<anonymous> (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:28:3285)\n    at listOnTimeout (node:internal/timers:608:17)\n    at process.processTimers (node:internal/timers:543:7)\n    at g3A.request (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:31:2129)\n    at async Gx4 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:505:16377)\n    at async I (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:505:14991)\n    at async Yx4 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:505:16607)\n    at async Wx4 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:505:17553)","timestamp":"2026-01-27T12:55:16.963Z"},{"error":"YiA: Failed to install new version of claude:  npm error code ENOTEMPTY\nnpm error syscall rename\nnpm error path /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code\nnpm error dest /opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V\nnpm error errno -66\nnpm error ENOTEMPTY: directory not empty, rename '/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code' -> '/opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V'\nnpm error A complete log of this run can be found in: /Users/yongtaelee/.npm/_logs/2026-01-27T12_55_29_700Z-debug-0.log\n    at PKA (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1873:389)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2811:32473","timestamp":"2026-01-27T12:55:30.074Z"},{"error":"YiA: Failed to install new version of claude:  npm error code ENOTEMPTY\nnpm error syscall rename\nnpm error path /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code\nnpm error dest /opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V\nnpm error errno -66\nnpm error ENOTEMPTY: directory not empty, rename '/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code' -> '/opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V'\nnpm error A complete log of this run can be found in: /Users/yongtaelee/.npm/_logs/2026-01-27T12_56_13_342Z-debug-0.log\n    at PKA (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1873:389)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2811:32473","timestamp":"2026-01-27T12:56:13.557Z"},{"error":"Error: read ECONNRESET\n    at eo.from (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:11:15035)\n    at UE.<anonymous> (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:29:10009)\n    at UE.emit (node:events:507:28)\n    at UE.emit (node:domain:489:12)\n    at ZQ1.<computed> (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:28:1117)\n    at ClientRequest.emit (node:events:519:35)\n    at ClientRequest.emit (node:domain:489:12)\n    at emitErrorEvent (node:_http_client:104:11)\n    at TLSSocket.socketErrorListener (node:_http_client:518:5)\n    at TLSSocket.emit (node:events:507:28)\n    at g3A.request (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:31:2129)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async v2I (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1558:467)\n    at async Promise.all (index 0)\n 

Note: Error logs were truncated.

View original on GitHub ↗

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