claude-code - 💡(How to fix) Fix [Bug] Context limit warning triggered incorrectly when limit not reached [2 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#49605Fetched 2026-04-17 08:36:27
View on GitHub
Comments
2
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4commented ×2cross-referenced ×1

Error Message

[{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 1080837 tokens > 1000000 maximum"},"request_id":"req_011Ca8LixSeA2R3hFxULs7TE"}\n at generate (B:/~BUN/root/src/entrypoints/cli.js:11:52456)\n at makeRequest (B:/~BUN/root/src/entrypoints/cli.js:50:4943)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-16T23:45:56.102Z"}]

Code Example

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 1080837 tokens > 1000000 maximum\"},\"request_id\":\"req_011Ca8LixSeA2R3hFxULs7TE\"}\n    at generate (B:/~BUN/root/src/entrypoints/cli.js:11:52456)\n    at makeRequest (B:/~BUN/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-16T23:45:56.102Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description "Context limit reached · /compact or /clear to continue" when it is not the case.

Environment Info

  • Platform: win32
  • Terminal: windows-terminal
  • Version: 2.1.112
  • Feedback ID: 00e2fd2b-d794-46be-b20b-8fc1ca33e07f

Errors

[{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 1080837 tokens > 1000000 maximum\"},\"request_id\":\"req_011Ca8LixSeA2R3hFxULs7TE\"}\n    at generate (B:/~BUN/root/src/entrypoints/cli.js:11:52456)\n    at makeRequest (B:/~BUN/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-16T23:45:56.102Z"}]

extent analysis

TL;DR

The issue is likely due to exceeding the maximum token limit for a prompt, and a workaround may involve shortening the input or using a different approach to avoid the limit.

Guidance

  • The error message indicates that the prompt is too long, exceeding the 1,000,000 token maximum, which suggests that the input needs to be shortened or optimized.
  • Reviewing the input data and identifying areas where it can be condensed or split into smaller requests may help mitigate the issue.
  • Consider using a more efficient data processing approach or optimizing the request payload to reduce its size.
  • If possible, verify the input data and ensure it is correctly formatted to avoid unnecessary characters or whitespace that could contribute to the token limit being reached.

Example

No code snippet is provided as the issue does not explicitly mention a specific code segment that needs modification.

Notes

The solution may vary depending on the specific requirements and constraints of the application or system being used. The error message suggests a clear limit, but the exact method to shorten or optimize the input will depend on the context in which this error occurs.

Recommendation

Apply workaround: Shorten the input prompt to avoid exceeding the token limit, as this directly addresses the error message's indication of the problem.

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] Context limit warning triggered incorrectly when limit not reached [2 comments, 2 participants]