[BUG] Claude Code fails with 'Prompt is too long' instead of auto-compacting

Resolved 💬 4 comments Opened Apr 10, 2026 by prasantadash Closed Apr 14, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] 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_

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗