[BUG] API Error: Too many cache_control blocks (5 found, maximum 4 allowed)

Resolved 💬 3 comments Opened Oct 4, 2025 by edwardchin811227 Closed Oct 7, 2025

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?

(uid=14_91):
When using Claude Code v2.0.5, I encounter an API error stating that too many cache_control blocks are
being sent. The error message indicates that 5 cache_control blocks were found, but the API only allows
a maximum of 4 blocks.

Error details:
{
"type": "error",
"error": {
"type": "invalid_request_error",
"message": "A maximum of 4 blocks with cache_control may be provided. Found 5."
}
}
}

What Should Happen?

oCmlmauundiec aCtoidneg swhiotuhl dt hree sApnetchtr otphiec AAPPII',s w4h-ibclho cekx cleiemdist tfhoer macxaicmhuem_ cloinmtirto lof a4n db ltohcek sr.equest should succeed without errors.

Error Messages/Logs

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"A maximum of 4 blocks     
  with cache_control may be provided. Found 5."},"request_id":"req_011CTmeBGSfjvavrqrZJHYHZ"}

Steps to Reproduce

(uid=14_140):

  1. Use Claude Code v2.0.5
  2. Perform operations that trigger API calls to Anthropic
  3. Observe the error message about exceeding cache_control blocks limit

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

i don't know

Claude Code Version

v2.0.5

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

<img width="1920" height="1040" alt="Image" src="https://github.com/user-attachments/assets/52304e65-fcf6-43b5-a62d-9f2d36f55cc0" />

View original on GitHub ↗

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