Claude Code · Requests and models
Prompt is too long / Context limit reached
The conversation plus everything Claude Code sends with it no longer fits in the model’s context window.
Message
The exact error
Context limit reached · /compact or /clear to continueAlso appears as:
- In -p output and transcripts
- Prompt is too long
- When automatic compaction failed
- Prompt is too long · automatic compaction failed: <the underlying error>
- Amazon Bedrock
- Input is too long for requested model.
Meaning
What it means
Every request carries the whole conversation plus the system prompt, tool definitions (including MCP servers), memory files like CLAUDE.md, and any attachments. When the total passes the model’s context window, the API refuses it. Auto-compact normally summarises older turns before this happens; seeing the error means it was turned off, failed, or a single huge message filled the window by itself.
Causes
Common causes
- A long session with auto-compact turned off
- Large pasted text, files or images in one message
- Many MCP servers whose tool definitions are sent with every request
- A very large CLAUDE.md or other memory file
Fix
How to fix it
Compact or start fresh
Run
/compactto summarise earlier turns, or/clearto start a new conversation. If/compactsaysNot enough messages to compact., the one message is too big: run/clearand resend with less pasted text.See what’s using the space
Run
/contextfor a breakdown of system prompt, tools, memory files and messages.Cut what’s sent every time
Disable unused MCP servers with
/mcp disable <name>, and trim large CLAUDE.md files. The context window checker shows how much a document takes before you paste it.Turn auto-compact back on
If you switched it off in
/configor withDISABLE_AUTO_COMPACT, turn it on again, or run/compactyourself before the window fills.
Related