[BUG] Claude Code hangs indefinitely on first message — startup quota_check API request never completes
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
Claude Code hangs indefinitely on the first message of any session. The UI shows a "thinking" spinner (Flambéing / Improvising / Cultivating / etc.) but no API request is made for the user's message. Debug logs show a startup /v1/messages request with source=quota_check that never gets a response logged, suggesting the app is wedged waiting on an uncompleted quota check.
Environment
- Claude Code version: 2.1.112 (native installer,
~/.local/bin/claude) - macOS
- Reproduces in both Ghostty and Terminal.app
- Opus 4.7 with xhigh effort AND Sonnet with low effort both hang
- Subscription: Claude Max
Steps to Reproduce
- Open terminal, cd to any directory (including empty ones like
/tmp/claude-test) - Run
claude --debug - Type "hello" and press Enter
- Session hangs indefinitely with thinking spinner; no response ever returned
What I've Ruled Out
Spent ~1 hour systematically eliminating local causes:
- ✅ Disabled
remoteControlAtStartupin~/.claude.json - ✅ Removed all MCP servers (Gmail, Google Calendar, Notion disconnected from web UI)
- ✅ Moved
~/.claude/pluginsaside — still hangs - ✅ Tested in empty directory with no project CLAUDE.md
- ✅ Tried both Opus 4.7 (xhigh) and Sonnet (low effort) — both hang
- ✅ Tested in Terminal.app (not just Ghostty) — same behavior
- ✅
curltohttps://api.anthropic.com/v1/messagesreturns 401 in 25ms (network healthy) - ✅
claude auth logout+claude auth login— still hangs - ✅ Piped input via
echo "hello" | claude --print— also hangs (not a keyboard/input issue) - ✅ Full clean reinstall:
rm -rf ~/.local/bin/claude ~/.local/share/claude+curl -fsSL https://claude.ai/install.sh | bash+ freshclaude auth login— still hangs
Key Debug Log Evidence
The startup quota check fires but no response is ever logged:
[DEBUG] [API REQUEST] /v1/messages x-client-request-id=ea0ff8e1-043d-43f6-8f69-4981a3530833 source=quota_check
After this line, the log shows only plugin init, LSP init, and periodic heartbeats/presence pulses. When "hello" is typed, NO new API request is logged — the app never submits the user's message. This suggests the quota check is blocking all subsequent requests.
Additional Notes
- Before disabling
remoteControlAtStartup,/remote-control is activeappeared at every session start despite never explicitly enabling it - Three
claude.aiMCP servers (Gmail, Google Calendar, Notion) were stuck in "Needs authentication" state but could not be removed viaclaude mcp remove— they are account-level and had to be disconnected via claude.ai web UI - Happy to attach full debug log from
~/.claude/debug/latestif needed
30bd82d3-68de-48fe-adfb-4bb514576791.txt
What Should Happen?
Claude should respond when i say 'hello' upon starting claude
Error Messages/Logs
Steps to Reproduce
i mean i think its on my instance somehow. but i go to terminal, type in claude, it opens, i enter 'hello' and it stalls forever
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.112 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
3 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Update: Resolved. Root cause identified.
The hang was caused by my
SessionStarthook running a shell script that launchedcaffeinatewith standard bash&backgrounding. Despite the&, Claude Code's hook runner appeared to wait on the backgrounded process, which never exited (caffeinate runs until killed). This wedged the session from startup — the UI showed a thinking spinner but no API request was ever submitted for user prompts, because the hook event itself never completed.Isolation steps that pinpointed it:
~/.claudeconfig aside entirely → claude worked fine.SessionStarthook active (caffeinate-start.sh using&), the hang reproduced reliably — 90s+ with no response to "hello".Fix: Rewrote the script to use
nohup ... & disowninstead of just&:After this change, startup is instant and sessions work normally.
Why I think this is worth a bug: The original script was correctly structured from a shell perspective — the backgrounded process should have detached and let the hook return. Other users writing SessionStart hooks that launch long-running background processes (caffeinate, tmux sessions, file watchers, etc.) will hit this exact issue with no clear error. Suggestions:
nohup + disownrequirement for hooks that spawn long-running background processes.&backgrounding works as expected.Unrelated but worth flagging from the same debugging session:
remoteControlAtStartup: truewas silently set in~/.claude.json(I don't recall opting in), which caused every session to route through the remote-control bridge and contributed to initial confusion. Flipping it tofalsewas required before the hook issue became visible.Versions tested: 2.1.112 on macOS, both Ghostty and Terminal.app, Opus 4.7 (xhigh) and Sonnet — identical behavior.
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.