Home/Wiki Errors/Claude Code
Claude Code / Context window

Prompt is too long - Claude Code context window

The conversation, attached files, memory files, and tool definitions no longer fit inside the selected model context window.

Claude Code context windowdisable MCP tools contextClaude Code compact prompt too long
Paste an error to match it against the wiki. / 粘贴报错后自动匹配。

Error text / 报错原文

  • Prompt is too long

What it means

The conversation, attached files, memory files, and tool definitions no longer fit inside the selected model context window.

Most common causes

  • Large files pasted directly into chat
  • Many MCP servers exposing large tool schemas
  • Old conversation turns kept after several coding loops
  • Subagents inheriting too many parent-session tools

Fastest fix

  • Run /compact, then retry the request
  • Run /context to see what is consuming tokens
  • Disable unused MCP servers with /mcp disable
  • Start a new focused session for the current task

Safe fix

  • Move big docs into files and ask for narrow ranges
  • Split a repo-wide request into smaller tasks
  • Trim stale CLAUDE.md instructions
  • Keep only task-relevant MCP servers enabled

What not to do

  • Do not attach build artifacts, lockfiles, or minified bundles unless needed
  • Do not blindly increase model budget when the source is stale context
  • Do not spawn subagents before reducing inherited tools

How to confirm the fix

Run the smallest reproducible command first, then retry the agent task only after authentication, quota, and tool discovery are stable.

claude doctor
claude --version
find . -name CLAUDE.md -maxdepth 4 -print

Related errors

Related tools

Sources