claude-code - 💡(How to fix) Fix [Bug] Claude 4.6 Opus generating corrupted/garbled output with invalid tokens [2 comments, 3 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#46202Fetched 2026-04-11 06:26:28
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
4
Author
Timeline (top)
labeled ×3commented ×2cross-referenced ×1

Error Message

[{"error":"MaxFileReadTokenExceededError: File content (11168 tokens) exceeds maximum allowed tokens (10000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n at xz7 (/$bunfs/root/src/entrypoints/cli.js:4358:12671)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-10T11:11:45.046Z"}]

Code Example

[{"error":"MaxFileReadTokenExceededError: File content (11168 tokens) exceeds maximum allowed tokens (10000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n    at xz7 (/$bunfs/root/src/entrypoints/cli.js:4358:12671)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-10T11:11:45.046Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description Opus 4.6 produces trash today: isaDog,␒�es, cs5S,c. n, c5DL, cs4, ND556, ND5, ND5, eations4, D2, Ics, ARs,4722, Ac601244ter ((1_1(4,1, Ic82, Ac4,2(12, Ac22(1, Ic1, Ic1, 1, Ic0, 1, 3,3Zero0, (2)1, 2(1, Ic0, 1, 3,3Zero0, (3)1, 2(1, Ic0, 1, 3,3Zero, 1, (4)1, 1, (5)1, 2(1, Ic0, 1, 3,3Zero, 1, 6(6)Apologies, some stray text appeared. I'll ignore it and continue.

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.100
  • Feedback ID: e51e460e-03b2-4f59-b778-89bf50825671

Errors

[{"error":"MaxFileReadTokenExceededError: File content (11168 tokens) exceeds maximum allowed tokens (10000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n    at xz7 (/$bunfs/root/src/entrypoints/cli.js:4358:12671)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-10T11:11:45.046Z"}]

extent analysis

TL;DR

To resolve the MaxFileReadTokenExceededError, use the offset and limit parameters to read specific portions of the file instead of reading the whole file.

Guidance

  • The error message indicates that the file content exceeds the maximum allowed tokens, suggesting that the file is too large to be read in a single operation.
  • To mitigate this issue, consider using pagination or chunking to read the file in smaller portions, utilizing the offset and limit parameters as suggested in the error message.
  • Review the code in cli.js at line 4358 to understand how the file is being read and modify it to implement pagination or chunking.
  • Verify that the file size is reasonable and that there are no other issues causing the file to be excessively large.

Example

No specific code example can be provided without more context, but the general approach would involve modifying the file reading logic to use offset and limit parameters, such as:

// Pseudo-code example, actual implementation may vary
const readFile = (filePath, offset, limit) => {
  // Implement file reading logic with offset and limit
};

const fileSize = getFileSize(filePath);
const chunkSize = 10000; // Adjust based on maximum allowed tokens
for (let i = 0; i < fileSize; i += chunkSize) {
  const chunk = readFile(filePath, i, chunkSize);
  // Process the chunk
}

Notes

The provided error message and code snippet suggest that the issue is related to reading a large file, but without more context, it's difficult to provide a precise solution. The ghostty terminal and darwin platform may have specific requirements or limitations that need to be considered.

Recommendation

Apply workaround: Modify the code to use pagination or chunking when reading large files to avoid exceeding the maximum allowed tokens. This approach allows for more efficient and reliable file processing.

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

claude-code - 💡(How to fix) Fix [Bug] Claude 4.6 Opus generating corrupted/garbled output with invalid tokens [2 comments, 3 participants]