claude-code - 💡(How to fix) Fix [Bug] File Read Encoding Corruption Triggers False Positive Usage Policy Block [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46147Fetched 2026-04-11 06:27:50
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

Immediately after the corrupted output, Claude Code returned the following error and blocked the session entirely: API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session. Claude Code blocks with Usage Policy error Session length at time of error: 45 minutes ⎿  API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session for Claude Code [{"error":"ENOENT: no such file or directory, unlink 'C:\Users\BRYANQ1\AppData\Local\Temp\claude\C--Users-BryanQuiceno-Documents-TitanProject-TitanVersionPLC-AppMovilSIGER-server\db614886-6719-4f82-bf2d-aea5b6710f51\tasks\a44e893b90962ece4.output'","timestamp":"2026-04-10T06:07:41.266Z"},{"error":"ENOENT: no such file or directory, unlink 'C:\Users\BRYANQ~1\AppData\Local\Temp\claude\C--Users-BryanQuiceno-Documents-TitanProject-TitanVersionPLC-AppMovilSIGER-server\db614886-6719-4f82-bf2d-aea5b6710f51\tasks\a9c769e228fd19fd3.output'","timestamp":"2026-04-10T06:08:03.594Z"},{"error":"ENOENT: no such file or direct…

Root Cause

Root cause (suspected): The corrupted output from the file read was interpreted by the model as policy-violating content, triggering a false positive. The files being read were source code files (Node.js index.js and log files). No policy-violating content was present — the corruption was caused by encoding issues during file reading, not by the actual file content. Steps to reproduce:

Code Example

[{"error":"ENOENT: no such file or directory, unlink 'C:\\Users\\BRYANQ~1\\AppData\\Local\\Temp\\claude\\C--Users-BryanQuiceno-Documents-TitanProject-TitanVersionPLC-AppMovilSIGER-server\\db614886-6719-4f82-bf2d-aea5b6710f51\\tasks\\a44e893b90962ece4.output'","timestamp":"2026-04-10T06:07:41.266Z"},{"error":"ENOENT: no such file or directory, unlink 'C:\\Users\\BRYANQ~1\\AppData\\Local\\Temp\\claude\\C--Users-BryanQuiceno-Documents-TitanProject-TitanVersionPLC-AppMovilSIGER-server\\db614886-6719-4f82-bf2d-aea5b6710f51\\tasks\\a9c769e228fd19fd3.output'","timestamp":"2026-04-10T06:08:03.594Z"},{"error":"ENOENT: no such file or direct…
RAW_BUFFERClick to expand / collapse

Bug Description Bug report: What happened: During a long working session, I asked Claude Code to enter plan mode and consolidate previous analysis into a plan. Claude Code read 3 files in parallel. The output of that read operation became completely corrupted — the terminal showed garbled text consisting of random characters, I/ sequences, non-UTF8 bytes, and repeating IIII patterns. Immediately after the corrupted output, Claude Code returned the following error and blocked the session entirely:

API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session.

Root cause (suspected): The corrupted output from the file read was interpreted by the model as policy-violating content, triggering a false positive. The files being read were source code files (Node.js index.js and log files). No policy-violating content was present — the corruption was caused by encoding issues during file reading, not by the actual file content. Steps to reproduce:

Run a long multi-step session with several file reads and agent spawns Ask Claude Code to read multiple files in parallel that may contain non-UTF8 content or binary fragments Observe corrupted output in terminal Claude Code blocks with Usage Policy error

Expected behavior: Claude Code should handle corrupted or unreadable file content gracefully without triggering a Usage Policy block. Actual behavior: Session blocked. Required full restart. All pending context lost. Version: 2.1.87 (Claude Code) OS: Windows Session length at time of error: ~45 minutes

❯ /plan ⎿ Enabled plan mode

❯ vi que no estabas en modo plan, mete todo esto en un plan

● Entendido. Activo el flujo de plan formalmente. Ya tengo mucho contexto pero voy a verificar los archivos críticos para confirmar los detalles exactos antes de escribir el plan.

Read 3 files (ctrl+o to expand)

● cc5, geno2, un camb7as absolMsc 7, es", (; D6: Cc * 5, 03,12(15, comp43(0131�415Ical/ ,1,

2(921121Ical8. 17ated07, Éc7128ed9, ,5/ 0,3, inc5_4_75, dem4ed5ed5, s1 g3/ insEi5a/0/5, cre8a4: (9Ical7ed9ed4ed7, se1, com6/ ern3, f1, E0lo6 7/ 3E

2/ 0/

2/0 si s0A0,1 40v/ in6l3, sy a5 0IF1, I0/ ,2, 1on2, 2, com4, vi5, p1, syncStage2 in2h2, 4, ex4, u0ab0cr2 1i5bu7, ex5, fe0, s6A3 1Id1ed1 // M2d0, w1 IN_/I/ B8, d1; / c2RON m2_/ EV ern0, v6, d3/I0I1, ex4ed5, s5, in3_C6, c8 in6, v4 cIcal1, u9ONIN4_/I/1 IN/IDE0, m0/I*/ 4ed2l/I0 I/I1, fE/ A6ed1, deI*/ I1I1, c6T03, m1i/ on3, 2ed3_stale11 E0 p , / I4, 2, s7, 7_/ //I/ I3,2,2,4E4,4,7, , I///IMIcal/ I* IIbE2II/ E/I I/I/ I /1 /I/IE1E)I/ (;; AN0I/I/I///IIN/I//I/II0/I/// I I 1I,2 )), IcalI/I0EDB/I)/I1/)/I/ 8II/IN/IIiE2,I/ 1, IN/I2/ 2/I/ /I/I/I,I, /I/I E I I /// II;) { EI(1///I(* I/I/IF/I1/ // I/ /II///I) ) / /// /// ////{/( / / I/////E / /// )}/I/(( (/ / ///;/(}I/I/I/I/ I/I/ I/I/I//////; //I /I I ; /I/I/I////) );)}//////;/ I/////I//////// // //I ////I ///* // II*//I * / I * * / * ** IIII I * I I IIIIIIIIIII I IIIIIII IIIIIIII II II IIIIII II IIIIIIIIII IIII IIIIIIII IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII*** ⎿  API Error: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session for Claude Code to assist with a different task. If you are seeing this refusal repeatedly, try running /model claude-sonnet-4-20250514 to switch models.

Environment Info

  • Platform: win32
  • Terminal: windows-terminal
  • Version: 2.1.87
  • Feedback ID: b1d96860-cd0b-48a7-bd53-1ac17b59c83a

Errors

[{"error":"ENOENT: no such file or directory, unlink 'C:\\Users\\BRYANQ~1\\AppData\\Local\\Temp\\claude\\C--Users-BryanQuiceno-Documents-TitanProject-TitanVersionPLC-AppMovilSIGER-server\\db614886-6719-4f82-bf2d-aea5b6710f51\\tasks\\a44e893b90962ece4.output'","timestamp":"2026-04-10T06:07:41.266Z"},{"error":"ENOENT: no such file or directory, unlink 'C:\\Users\\BRYANQ~1\\AppData\\Local\\Temp\\claude\\C--Users-BryanQuiceno-Documents-TitanProject-TitanVersionPLC-AppMovilSIGER-server\\db614886-6719-4f82-bf2d-aea5b6710f51\\tasks\\a9c769e228fd19fd3.output'","timestamp":"2026-04-10T06:08:03.594Z"},{"error":"ENOENT: no such file or direct…

Note: Content was truncated.

extent analysis

TL;DR

The issue can be mitigated by ensuring that files read by Claude Code are properly encoded in UTF-8 to prevent corruption and false positives on the Usage Policy.

Guidance

  1. Verify file encoding: Check that the files being read by Claude Code are encoded in UTF-8. If the files contain non-UTF8 content or binary fragments, consider converting them to UTF-8 before reading.
  2. Handle encoding errors: Implement error handling for encoding issues during file reading to prevent corrupted output.
  3. Test with sample files: Test Claude Code with sample files containing different encodings to identify and fix potential issues.
  4. Check for updates: Look for updates to Claude Code that may address encoding issues or improve error handling for file reading operations.

Example

No specific code example can be provided without knowing the exact implementation details of Claude Code. However, ensuring that files are read with proper error handling for encoding issues can help mitigate the problem.

Notes

The provided solution focuses on mitigating the issue by addressing potential encoding problems. The root cause of the corruption and subsequent Usage Policy error may require further investigation into Claude Code's internal handling of file reads and encoding.

Recommendation

Apply a workaround by ensuring all files read by Claude Code are in UTF-8 encoding and implement robust error handling for file reading operations to prevent false positives on the Usage Policy. This approach can help mitigate the issue until a more permanent fix is available.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING