Invalid API Request Breaks Claude Session During Anthropic Documentation Fetch

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 7 comments · opened Apr 1, 2025 · closed Apr 1, 2025
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Bug Description
when fetching antrhopic docs, we get an error 400 and claude session becomes unusable.

Environment Info

  • Platform: macos
  • Terminal: ghostty
  • Version: 0.2.57
  • Feedback ID: 45c2e27a-3859-4507-a68a-701297704a28

Errors

[{"error":"AxiosError: Request failed with status code 403\n    at RA (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:439:1070)\n    at BrotliDecompress.H0 (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:440:9949)\n    at BrotliDecompress.emit (node:events:531:35)\n    at BrotliDecompress.emit (node:domain:488:12)\n    at endReadableNT (node:internal/streams/readable:1696:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)\n    at jT.request (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:442:2074)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at async Zc2 (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3354:1075)\n    at async Gc2 (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3354:1951)\n    at async Object.call (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3354:6468)\n    at async Zj5 (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:4719)\n    at async K31 (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:3293)\n    at async _N2 (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:934:511)\n    at async Ij5 (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2640)\n    at async ES1 (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:3283:2471)","timestamp":"2025-04-01T19:45:23.463Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.16.content.1: each tool must have a single result. Found multiple `tool_result` blocks with id: toolu_01An7aJYaSBCt9xcS6vQ4XKD\"}}\n    at J6.generate (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:837:29204)\n    at $6.makeStatusError (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:841:7207)\n    at $6.makeRequest (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:841:8149)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-04-01T19:45:23.648Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.16.content.1: each tool must have a single result. Found multiple `tool_result` blocks with id: toolu_01An7aJYaSBCt9xcS6vQ4XKD\"}}\n    at J6.generate (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:837:29204)\n    at $6.makeStatusError (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:841:7207)\n    at $6.makeRequest (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:841:8149)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-04-01T19:45:25.729Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"messages.16.content.1: each tool must have a single result. Found multiple `tool_result` blocks with id: toolu_01An7aJYaSBCt9xcS6vQ4XKD\"}}\n    at J6.generate (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:837:29204)\n    at $6.makeStatusError (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:841:7207)\n    at $6.makeRequest (file:///Users/omar/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:841:8149)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)","timestamp":"2025-04-01T19:45:31.377Z"}]

View original on GitHub ↗

7 Comments

omararambula · 1 year ago
can you check what help settings claude code has available

⏺ Bash(claude code --help)…
  ⎿  Usage: claude [options] [command] [prompt]

Claude Code - starts an interactive session by default, use -p/--print
for
non-interactive output

Arguments:
prompt Your prompt

Options:
-d, --debug Enable debug mode
--verbose Override verbose mode setting from
config
-p, --print Print response and exit (useful for
pipes)
--json Output JSON in the shape {cost_usd:
number,
duration_ms: number, duration_api_ms:
number,
result: string} (only works with
--print)
--mcp-debug Enable MCP debug mode (shows MCP
server
errors)
--dangerously-skip-permissions Bypass all permission checks. Only
works in
Docker containers with no internet
access.
--allowedTools <tools...> Comma or space-separated list of tool
names
to allow (e.g. "Bash(git*) Edit
Replace")
-v, --version output the version number
-h, --help display help for command

Commands:
config Manage configuration (eg. claude
config set
-g theme dark)
mcp Configure and manage MCP servers
migrate-installer Migrate from global npm installation
to local
installation
doctor Check the health of your Claude Code
auto-updater
update Check for updates and install if
available

check what you can do in config

⏺ Bash(claude config --help)…
  ⎿  Usage: claude config [options] [command]

Manage configuration (eg. claude config set -g theme dark)

Options:
-h, --help display help for command

Commands:
get [options] <key> Get a config value
set [options] <key> <value> Set a config value
remove|rm [options] <key> [values...] Remove a config value or items
from a config array
list|ls [options] List all config values
add [options] <key> <values...> Add items to a config array
(space or comma separated)
help [command] display help for command

⏺ Bash(claude config list)…
  ⎿  {
"allowedTools": [],
"dontCrawlDirectory": false,
"hasTrustDialogAccepted": true,
"hasCompletedProjectOnboarding": true,
"ignorePatterns": []
}

i saw something about an api key

⏺ Let me check if there's information about API keys in the configuration
options:

⏺ Bash(claude config set --help)…
  ⎿  Usage: claude config set [options] <key> <value>

Set a config value

Options:
-g, --global Use global config
-h, --help display help for command

⏺ Fetch(url: "https://docs.anthropic.com/en/docs/agents-and-tools/claude-co…e
/overview", prompt: "Find any information about setting up API keys or
authentication for Claude Code")
⎿  Received 0 bytes (403 Forbidden)
Error: Request failed with status code 403
⎿  Received 0 bytes (403 Forbidden)
Error: Request failed with status code 403
⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","

hello

⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","

you there

⎿ API Error: 400 {"type":"error","error":{"type":"invalid_request_error","

/bug

  ⎿  Bug report submitted

bcherny collaborator · 1 year ago

Thanks for the report. Fix incoming!

jmanhype · 1 year ago
Thanks for the report. Fix incoming!

having the same issue again please fix !

I pay for the 200 dollar MAX membership after a day of heavy use. I now get this message after the second or first reply I give claude.

⎿ API Error: 400
{"type":"error","error":{"type":"invalid_request_error","message":"tools.339.custom.name: String should
have at most 64 characters"}

RIGHT NOW CLAUDE CODE IS UNUSABLE

zachmayer · 1 year ago

I'm hitting this one too. It happened in a big, complex conversation: I can't even compact it!

zachmayer · 1 year ago

Here's my workaround:

  1. Resume the conversation with claude --resume
  2. Manually copy/paste the history into https://claude.ai/
  3. Ask claude to summarize the convo as a markdown artifact
  4. Copy/paste the markdown summary back into a new claude session
Zenetusken · 1 year ago

Wow this is really a bummer. Totally disrupts the... vibe, which is what generates the $ for Anthropic unless I'm mistaken. Please fix.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.