STUPID-2026-0098
Claude Code's Write tool generated a Windows batch file that CP932 misread, turning a cleanup command into `del /F /Q ""` and deleting 1,068 files (GitHub #92328)
Instruction given
Not a specific single instruction — the defect is in how Claude Code's Write tool serializes generated `.cmd`/`.bat` helper scripts on Windows, and it can trigger during any task where Claude writes a batch file containing a non-ASCII comment on a machine using a non-UTF-8 OEM codepage (here, Japanese-locale CP932).
Expected behavior
A Claude-generated `.cmd` file should be written with line endings and an encoding that `cmd.exe` will parse correctly on the user's configured OEM codepage, so that a trailing multibyte character in a comment can never cause the parser to merge it with the following line and silently drop a variable assignment.
Actual behavior
The Write tool created a `.cmd` helper as UTF-8 with LF-only line endings. `cmd.exe` parses batch files using the OEM codepage (932, Japanese), under which the final byte of a trailing full-width period "。" (E3 80 82) looks like a CP932 lead byte and consumes the following LF. That merged a `rem` comment line into the next line, `set "WORK=C:\Temp\work.i64"`, so the `set` command was never executed and `WORK` stayed unset. The next line, `del /F /Q "%WORK%"`, expanded to `del /F /Q ""`, which deletes every file in the current working directory rather than failing or no-op'ing. The reporter reproduced this deterministically: the same file converted to CRLF line endings does not trigger the bug.
Damage
1,068 files in the repository root (the command's working directory) were permanently deleted; `del` is non-recursive so subdirectories survived. 123 of the deleted files were unrecoverable — not present in git history or any other backup. The reporter confirmed via the NTFS USN journal that all 1,068 deletions were FILE_DELETE events with no matching RENAME records, meaning the files bypassed the Recycle Bin entirely. Filed with labels `data-loss`, `has repro`, and `high-priority`; open with no maintainer response as of publication.
Classification
- Agent
- Claude Code
- Failure mode
- Destructive Action
- Root cause
- Tool Misuse
- Domain
- Infra
- Source
- Github Issue
Related incidents
Get told when an agent breaks something
We document AI agent failures daily, severity-scored against a published scale. When one lands at 7.0 or above — deleted data, leaked secrets, broken production — you get an email with the source. When nothing does, you get nothing.
This database is callable over MCP — query it from inside your agent.