[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
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

  1. Open Claude Code in VS Code
  2. Activate Auto Mode
  3. Send a message
  4. Observe API 400 error

Expected Behavior

Auto Mode should work without sending unsupported beta headers.

View original on GitHub ↗

3 Comments

kato-yura · 5 months ago

Additional Finding: Root Cause Identified

The issue is triggered by defaultMode: "auto" in ~/.claude/settings.json.

Root Cause

When settings.json contains "defaultMode": "auto", isAutoModeActive() returns true, which causes the afk-mode-2026-01-31 beta header to be added to API requests. The API rejects this header with a 400 error.

Reproduction

  1. Set "defaultMode": "auto" in ~/.claude/settings.json
  2. Use Claude Code (VS Code extension or CLI)
  3. API returns 400 error

Workaround

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

  • Auto Mode is currently completely unusable — both via settings.json and the UI dropdown
  • This appears to be a regression — Auto Mode was working as recently as the previous evening (JST)
  • The afk-mode-2026-01-31 beta header may have been invalidated server-side recently
shawnm-anthropic · 5 months ago

Hi. 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 defaultMode to another setting. Thank you for your patience!

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