Claude Code "Prompt Is Too Long": Fix It with /compact, /context and Less Context
What Prompt is too long means, whether to wait, and what to check first.
Language: English · 日本語版
Wait or fix?
Fix it in the session; waiting will not help. The conversation plus attached files exceeds the model's context window, so the same request fails again until less is sent. The usual fix takes seconds: /compact summarizes earlier turns, and /clear starts fresh. If the error comes back right after a clear, the space is taken by what Claude Code sends with every request, such as tool definitions, memory files and attachments, and that is what to trim.
Messages you may see
Prompt is too longContext limit reached · /compact or /clear to continuePrompt is too long · automatic compaction failed: <the underlying error>Input is too long for requested model.
The exact wording changes a little between Claude Code versions and providers.
What the message means
Auto-compact is on by default and normally prevents this error by summarizing your oldest exchanges and keeping the newest. In an interactive session the error appears as "Context limit reached · /compact or /clear to continue", and the line also tells you when auto-compact is off. Amazon Bedrock reports the same condition as "Input is too long for requested model." When automatic compaction ran and failed on another error, such as an unavailable model or an authentication failure, the message names that error after a separator, and /compact keeps failing until you resolve it. A conversation with a single exchange has nothing earlier to summarize, so Claude Code explains what fills the request instead.
Common causes
- A long conversation with large file reads or pasted logs.
- Tool definitions from MCP servers you are not using.
- Large CLAUDE.md memory files that load on every request.
- Auto-compact turned off in
/configor withDISABLE_AUTO_COMPACT. - A custom model ID through a gateway, where Claude Code assumed a context window that differs from the real one.
Check in this order
- Run
/compact. If it answers "Not enough messages to compact.", run/clearand resend with less pasted text or smaller attachments. - If the message says automatic compaction failed, fix the error it names first, then run
/compactagain. - Run
/contextto see what is using the window: system prompt, tools, memory files and messages. - Disable MCP servers you are not using with
/mcp disable <name>, and trim large CLAUDE.md files or move instructions into path-scoped rules that load only when relevant. - If you turned auto-compact off, turn it back on in
/config. If you keep it off, run/compactyourself before the window fills. - If Claude Code warned that it does not recognize your model ID, give it the model's real context window as the model configuration page describes.
We took the fixes from the official pages below and put them in order, with the quickest and most likely ones first.
How it differs from similar errors
- "Request too large (max 32MB)" is about the size of the raw request body, mostly attachments. That limit is separate from the context window.
- "Response exceeded the output token maximum" is about the length of Claude's reply, not your input.
- "You've hit your session limit" is about your plan's allowance, not the size of one conversation.
Related errors
Official sources
- Claude Code error reference: Prompt is too long (checked 2026-11-20)
- Claude Code error reference: Automatic retries (context limit) (checked 2026-11-20)
Unofficial page. Not affiliated with, endorsed by, or sponsored by Anthropic, PBC. Claude and Claude Code are trademarks of Anthropic, PBC. Messages and fixes change with updates, so read the official pages as well.