Skip to content

fix: strip cache_control.scope from content blocks#14

Open
Alex-dev-spec wants to merge 1 commit intohorselock:mainfrom
Alex-dev-spec:fix/strip-cache-control-scope
Open

fix: strip cache_control.scope from content blocks#14
Alex-dev-spec wants to merge 1 commit intohorselock:mainfrom
Alex-dev-spec:fix/strip-cache-control-scope

Conversation

@Alex-dev-spec
Copy link
Copy Markdown

Problem

Claude Code now sends cache_control.scope in content blocks, which the Anthropic API rejects with:

system.N.cache_control.ephemeral.scope: Extra inputs are not permitted

This causes 400 errors on every request that includes system prompt caching when using a recent version of Claude Code.

Fix

Strip cache_control.scope in processContentArray, mirroring the existing logic that already strips cache_control.ttl for the same reason.

if (item.cache_control.scope) {
  delete item.cache_control.scope;
  Logger.debug('Removed scope from cache_control');
}

Testing

Deployed and tested on a production GCP proxy instance for 2 days. No 400 errors related to cache_control fields after the fix. Behaviour is identical to the ttl stripping already present in the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant