Dispatch feature ignores CLAUDE_CODE_DISABLE_1M_CONTEXT — "Usage credits required for 1M context" blocks background agents
Bug Report
Summary
The Mac app's dispatch (background agent) feature fails with API Error: Usage credits required for 1M context even when CLAUDE_CODE_DISABLE_1M_CONTEXT=1 is set through every available mechanism.
Steps to Reproduce
- Set
CLAUDE_CODE_DISABLE_1M_CONTEXT: "1"in~/.claude/settings.jsonunderenv - Set
export CLAUDE_CODE_DISABLE_1M_CONTEXT=1in~/.zprofile - Run
launchctl setenv CLAUDE_CODE_DISABLE_1M_CONTEXT 1to apply to all GUI processes - Fully quit and relaunch the Claude Code Mac app
- Attempt to dispatch a background agent
Expected Behavior
Dispatch uses the standard 200K context model, consistent with the CLAUDE_CODE_DISABLE_1M_CONTEXT flag and "model": "sonnet" setting.
Actual Behavior
API Error: Usage credits required for 1M context · turn on usage credits at claude.ai/settings/usage, or use --model to switch to standard context
The error persists across all three ways of setting the env var and survives a full app restart.
Environment
- Platform: macOS
- App: Claude Code Mac app
- Model setting:
"model": "sonnet"in~/.claude/settings.json CLAUDE_CODE_DISABLE_1M_CONTEXTset via:settings.jsonenv,~/.zprofile, andlaunchctl setenv
Workaround
None found other than enabling usage credits. The flag appears to be ignored by the dispatch code path.
Notes
The flag works correctly for normal (non-dispatch) sessions. The issue is specific to the background agent dispatch feature in the Mac app, suggesting it spawns processes through a different code path that does not inherit or respect the disable flag.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗