[BUG] maximum of 4 blocks with cache_control may be provided

Resolved 💬 17 comments Opened Sep 30, 2025 by zhongwen-xu Closed Jan 10, 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?

it should just work, but it only works for CLI, not the vscode extension

What Should Happen?

Claude should just repsonse without error.

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_011CTdncGQHoWvTQh8WTVMWb"}"

Steps to Reproduce

open the updated vscode extension, type anything, it reports 400 error.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.0.0 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

17 Comments

luckyCity · 9 months ago

In the terminal using Claude Code, this issue also occurs on my end, but it started appearing from version 1.0.128. It disappears after I downgrade the version, and the problem persists in version 2.0 as well. The error content is:

"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_011CTcSQCjcKsqyvV95aH1Bi\"}"

MyPrototypeWhat · 9 months ago

I am the same, an error occurs when using @ to reference files.

MyPrototypeWhat · 9 months ago

I tried it and this bug only works in the VSCode plugin, not in the terminal

luckyCity · 9 months ago
I tried it and this bug only works in the VSCode plugin, not in the terminal

Just upgrade the server for the forwarding service

edwardchin811227 · 9 months ago

I have the same issue. how to fix it?

morrisg222 · 9 months ago

I am also experiencing this issue. Is there any solution available at this time?

edwardchin811227 · 9 months ago

Thank you.

kaeelo5 @.***> 于2025年10月9日周四 06:41写道:

kaeelo5 left a comment (anthropics/claude-code#8419) <https://github.com/anthropics/claude-code/issues/8419#issuecomment-3383464492> [System.Environment]::SetEnvironmentVariable("DISABLE_PROMPT_CACHING","1","User") — Reply to this email directly, view it on GitHub <https://github.com/anthropics/claude-code/issues/8419#issuecomment-3383464492>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/A7VFWIYZURUUQR7ZOFVHSWD3WWHKRAVCNFSM6AAAAACH3FJNYKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTGOBTGQ3DINBZGI> . You are receiving this because you commented.Message ID: @.***>
minorcell · 9 months ago

I tried using claude code in the terminal instead of in VSCode, and the issue still occurred.

Steve0x2a · 9 months ago

same issue

minorcell · 9 months ago

@claude Please try to analyze why and how to solve it.

kaeelo5 · 9 months ago

this will fix it for you:
[System.Environment]::SetEnvironmentVariable("DISABLE_PROMPT_CACHING","1","User")

Please run on admin terminal

Wang-007 · 9 months ago

same issue. how to fix it?

minorcell · 9 months ago
@claude Please try to analyze why and how to solve it.

It seems that Claude can only be triggered by contributors to the repository.

minorcell · 9 months ago
> Please try to analyze why and how to solve it. It seems that Claude can only be triggered by contributors to the repository.

<img width="1123" height="692" alt="Image" src="https://github.com/user-attachments/assets/500f9b82-b9c1-417b-8359-bbf21d779b05" />

github-actions[bot] · 7 months ago

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] · 6 months ago

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] · 6 months 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.