claude-code - 💡(How to fix) Fix [BUG] Claude Code fails with 'Prompt is too long' instead of auto-compacting [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#46348Fetched 2026-04-11 06:22:38
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

When context grows large, Claude Code returns "Prompt is too long" errors repeatedly instead of automatically compacting, and manual /compact was required to unblock work.

It had compacted the conversations few times earlier. So I suspect when I attached document with SQL query result (Claude Code asked for it), it might have exceed token limit unexpectedly.

<img width="966" height="562" alt="Image" src="https://github.com/user-attachments/assets/71e10852-54b3-4c17-9672-c85d41499892" />

What Should Happen?

It should detect the issue and either trigger compaction or prompt user to do it.

Error Messages/Logs

Steps to Reproduce

Working in a large C codebase, attaching files, having extended conversation until context fills up. Attaching files with long text might help.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.100 (Claude code extension on VS code )

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

No response

extent analysis

TL;DR

Manually compacting the conversation or adjusting the token limit may resolve the "Prompt is too long" errors when working with large contexts in Claude Code.

Guidance

  • Verify that the issue is indeed caused by exceeding the token limit by checking the conversation history and the size of the attached files, especially those with long text like SQL query results.
  • Try manually compacting the conversation using the /compact command to see if it resolves the issue temporarily.
  • Consider adjusting your workflow to avoid attaching large files or breaking down the conversation into smaller, more manageable parts to prevent reaching the token limit.
  • If the issue persists, investigate whether there are any settings or configurations in Claude Code or the Anthropic API that can be adjusted to increase the token limit or improve automatic compaction.

Example

No specific code snippet is applicable in this case, as the issue seems related to the interaction with the Claude Code interface and the Anthropic API rather than a code-level problem.

Notes

The exact solution may depend on the specifics of the Claude Code version (2.1.100) and the Anthropic API's limitations and configurations. Since this is identified as a regression, comparing the behavior with previous versions might provide insights.

Recommendation

Apply workaround: Manually compact conversations or adjust workflows to manage token limits, as this directly addresses the symptom described and can provide a temporary solution 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