[BUG] When a conversation gets large enough to trigger context compaction, subsequent API calls fail

Resolved 💬 3 comments Opened Mar 1, 2026 by butagreeza Closed Mar 5, 2026

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?

When a conversation gets large enough to trigger context compaction, subsequent API calls fail with:
API Error: 400 {"type":"error","error":{"type":"invalid_request_error",
"message":"messages.2.content.2.tool_use.name: String should have at most 200 characters"}}

What Should Happen?

subsequent API calls should not fail
Context compaction should preserve valid tool_use names (<=200 chars).

Error Messages/Logs

Steps to Reproduce

  1. Have a long conversation with many tool calls (file reads, bash commands, subagents, etc.)
  2. Continue until context compaction kicks in
  3. The next API call fails with the above error

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

claude-opus-4-6

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

  • Claude Code VSCode extension
  • Model: claude-opus-4-6
  • macOS (Darwin 25.3.0, arm64)

View original on GitHub ↗

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