[BUG] Auto Mode sends unsupported "afk-mode-2026-01-31" beta header causing API 400 error
Status Fixed / completed
Reported on v2.1.74
Maintainer reply None cached
Workaround ✓ Mentioned in thread ↓
Activity 3 comments · opened Mar 13, 2026 · closed Mar 13, 2026
Bug Description
When Auto Mode is active in the VS Code extension, Claude Code sends the afk-mode-2026-01-31 value in the anthropic-beta header, which the API rejects with a 400 error.
Error Message
API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"Unexpected value(s) afk-mode-2026-01-31 for the anthropic-beta header. Please consult our documentation at docs.claude.com or try again without the header."},"request_id":"req_011CYzK2HKC3cUKSrnQbCxX5"}
Root Cause
In cli.js, the afk-mode-2026-01-31 header is conditionally added when isAutoModeActive() returns true, but this value is not in the supported beta set and is rejected by the API.
Environment
- Claude Code version: 2.1.74 (both CLI and VS Code extension)
- OS: macOS (Darwin 24.4.0)
- Node.js: v22.14.0
- ANTHROPIC_BASE_URL: https://api.anthropic.com (direct, no proxy)
Steps to Reproduce
- Open Claude Code in VS Code
- Activate Auto Mode
- Send a message
- Observe API 400 error
Expected Behavior
Auto Mode should work without sending unsupported beta headers.
3 Comments
Additional Finding: Root Cause Identified
The issue is triggered by
defaultMode: "auto"in~/.claude/settings.json.Root Cause
When
settings.jsoncontains"defaultMode": "auto",isAutoModeActive()returnstrue, which causes theafk-mode-2026-01-31beta header to be added to API requests. The API rejects this header with a 400 error.Reproduction
"defaultMode": "auto"in~/.claude/settings.jsonWorkaround
Changing
"defaultMode": "auto"to"defaultMode": "default"resolves the error, but this disables Auto Mode entirely (the Auto Mode option also disappears from the dropdown).Impact
settings.jsonand the UI dropdownafk-mode-2026-01-31beta header may have been invalidated server-side recentlyHi. Thank you for your interest in Auto Mode! I'm afraid it's not quite ready yet. We'll make an announcement when it is. Until then, please switch your
defaultModeto another setting. Thank you for your patience!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.