claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] API Error 400: Tool name exceeds 200 character limit causing complete session failure

Open Shamdon opened this issue 3 months ago • 5 comments

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Claude Code session becomes completely unresponsive with API error 400 after extended usage (~75+ messages). All subsequent commands, including simple text responses, trigger the same error about tool names exceeding 200 characters. Session becomes completely unusable with no recovery mechanism.

What Should Happen?

  • Tool names should never exceed the 200 character API limit
  • If individual commands fail, the session should remain functional for other commands
  • Simple text responses should not be affected by tool name length issues
  • There should be graceful error handling and recovery mechanisms

Error Messages/Logs

API Error: 400
  {"type":"error","error":{"type":"invalid_request_error","message":"messages.75.content.1.tool_use
  .name: 
  String should have at most 200 characters"},"request_id":"req_011CSyQ2VgbQwSWHfbzxPhpV"}

Steps to Reproduce

  1. Start a new Claude Code session
  2. Perform extended analysis work over ~75+ message exchanges including: - Use Read tool on large files (20MB+) - Use Task tool for complex multi-step analysis - Use WebSearch for research - Generate comprehensive reports/documentation
  3. Attempt a basic git command like: git remote add origin https://github.com/username/anyrepo.git
  4. Observe API 400 error appears
  5. Try any subsequent command (even simple text like "Need help?")
  6. All commands now fail with the same API 400 error

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

1.0.109 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

The error seems to be triggered after extensive session use, specifically around message 75. Once it occurs, the session becomes completely corrupted - even simple text responses that shouldn't involve any tools trigger the same API error. The only workaround is force quitting (Ctrl+C) and restarting Claude Code, which loses all conversation context and work progress.

Shamdon avatar Sep 10 '25 00:09 Shamdon

Which MCP servers do you have installed? Claude Code's built-in tools should not run into this issue.

If this happens, one way to recover is to rewind your conversation. You can access the rewind menu by pressing Esc twice.

dicksontsai avatar Sep 10 '25 00:09 dicksontsai

I’ve had the same issue over the weekend multiple times. To confirm, I do not have any MCP servers hooked up.

skercher avatar Sep 10 '25 02:09 skercher

Just had this as well with 1.0.117.

ramnes avatar Sep 18 '25 13:09 ramnes

@dicksontsai this just happened to me right after compacting a conversation

ericc59 avatar Nov 05 '25 22:11 ericc59

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 12 '25 10:12 github-actions[bot]