Skip to content

background_output and background_cancel tool names trigger billing validator rejection #190

@SeaL773

Description

@SeaL773

Problem

Anthropic's billing validator rejects the tool names background_output and background_cancel, returning a spurious 400 "You're out of extra usage" error — the same class of issue fixed for todowrite in #189.

Reproduction

  • Any request with 3+ tools that includes background_output or background_cancel returns 400
  • Renaming them (e.g. backgroundOutput / backgroundCancel) resolves the issue
  • Confirmed with isolated curl tests against the API (same OAuth token, same headers, only tool name differs)

Binary search results:

Test Result
23 tools (no background_*) ✅ 200
23 tools + background_output ❌ 400
23 tools + background_cancel ❌ 400
23 tools + bg_output (renamed) ✅ 200
All 31 tools with both renamed ✅ 200

Debug log

{"ts":"...","event":"fetch_body_debug","modelId":"claude-opus-4-6","system":[{"type":"text","text":"x-anthropic-billing-header: cc_version=2.1.105.834; cc_entrypoint=cli; cch=8f434;"},{"type":"text","text":"You are Claude Code, Anthropic's official CLI for Claude."}],"toolCount":31,"toolNames":["question","bash","read","glob","grep","edit","write","task","webfetch","TodoWrite"],"url":"https://api.anthropic.com/v1/messages"}
{"ts":"...","event":"fetch_response","status":400,"modelId":"claude-opus-4-6","retryAttempt":0}
{"ts":"...","event":"fetch_error_response","status":400,"modelId":"claude-opus-4-6","message":"You're out of extra usage. Add more at claude.ai/settings/usage and keep going."}

Suggested fix

Add background_output and background_cancel to the BLOCKED_TOOL_NAMES map in transforms.ts:

const BLOCKED_TOOL_NAMES: Record<string, string> = {
  "todowrite": "TodoWrite",
  "background_output": "backgroundOutput",
  "background_cancel": "backgroundCancel",
}

And add reverse mappings in stripToolPrefix:

.replace(/"name"\s*:\s*"backgroundOutput"/g, '"name": "background_output"')
.replace(/"name"\s*:\s*"backgroundCancel"/g, '"name": "background_cancel"')

Related: #189

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions