Anthropic API Context Limit Exceeded During Compaction

Resolved 💬 8 comments Opened Jul 16, 2025 by Chandru-fw Closed Jan 8, 2026

Bug Description
Claude code asked me to use /compact to continue but when i gave that got this issue ," Error: Error during compaction: Error: API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"input length and max_tokens exceed
context limit: 196261 + 20000 > 200000, decrease input length or max_tokens and try again"}}"

Environment Info

  • Platform: darwin
  • Terminal: cursor
  • Version: 1.0.52
  • Feedback ID: a46aa7c1-3181-4811-83f3-b80290801483

Errors

[{"error":"Error: Command failed: security find-generic-password -a $USER -w -s \"Claude Code\"\nsecurity: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.\n\n    at genericNodeError (node:internal/errors:983:15)\n    at wrappedFn (node:internal/errors:537:14)\n    at checkExecSyncError (node:child_process:882:11)\n    at execSync (node:child_process:954:15)\n    at eD (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:706:6320)\n    at file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:618:14473\n    at Q (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:520:14406)\n    at AF (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:618:13613)\n    at gC (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:618:12479)\n    at $B (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:618:17093)","timestamp":"2025-07-16T07:07:34.966Z"},{"error":"Error: 1: ENOENT \n    at XhQ (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1337:5208)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async JhQ (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1337:2578)","timestamp":"2025-07-16T07:07:35.853Z"},{"error":"Error: spawn /Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/vendor/ripgrep/arm64-darwin/rg ENOENT\n    at ChildProcess._handle.onexit (node:internal/child_process:285:19)\n    at onErrorNT (node:internal/child_process:483:16)\n    at process.processTicksAndRejections (node:internal/process/task_queues:90:21)","timestamp":"2025-07-16T07:10:10.064Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: example\n    at file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1381:418\n    at Object.useMemo (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:65:26277)\n    at DNB.useMemo (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:46:15576)\n    at aY (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1381:312)\n    at Ew (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:65:19804)\n    at _P (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:42569)\n    at PP (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38118)\n    at IL (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38046)\n    at xw (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:37900)\n    at PW (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:34990)","timestamp":"2025-07-16T07:22:02.429Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: example\n    at file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1381:418\n    at Object.useMemo (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:65:26277)\n    at DNB.useMemo (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:46:15576)\n    at aY (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1381:312)\n    at Ew (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:65:19804)\n    at _P (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:42569)\n    at PP (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38118)\n    at IL (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:38046)\n    at xw (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:37900)\n    at PW (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:67:34990)","timestamp":"2025-07-16T07:22:14.718Z"},{"error":"Error: Language not supported while highlighting code, falling back to markdown: \n    at file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1381:418\n    at Object.useMemo (file:///Users/cs/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:65:26277)\n    at DNB.useMemo (file:///User

Note: Error logs were truncated.

View original on GitHub ↗

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