Initial prompt sometimes produces no response — session hangs silently after Infusing
Description
After starting a Claude Code session and entering the initial prompt, the session sometimes produces no response at all. The user sees "Infusing..." with a growing timer, but no assistant output ever appears. Canceling (Escape/Ctrl+C) and re-entering the same prompt usually works on the second attempt.
This is intermittent — the same prompt may work immediately in one session and hang indefinitely in the next.
---
Observed Behavior
| What the user sees | What actually happens |
|---|---|
| "Infusing..." spinner with growing timer (1m+) | Session appears stuck during initial context loading |
| No assistant response, no tool calls | JSONL log shows no assistant messages |
| Canceling and re-entering works | Second attempt processes normally |
| Sometimes no visual feedback at all | Session accepted prompt but never started processing |
Evidence: Abandoned Session
Session 3afde30d contains exactly 1 JSONL line — the entire log:
{
"type": "queue-operation",
"operation": "enqueue",
"timestamp": "2026-03-31T13:16:48.664Z",
"sessionId": "3afde30d-...",
"content": "wann kriege ich eine rückmeldung?"
}
The user typed this message while waiting for a response that never came. No file-history-snapshot, no assistant message, no system message — the session never started processing.
Statistical Analysis: First Turn Duration
Analysis of 24 recent sessions shows abnormally long first turns:
| Metric | Value |
|--------|-------|
| Min | 35s |
| Max | 527s |
| Median | 156s |
| Mean | 181s |
| >120s | 50% of sessions |
| >300s (5+ min) | 21% of sessions |
Distribution
<= 30s: 0 sessions
<= 60s: 5 sessions █████
<= 120s: 12 sessions ████████████
<= 180s: 13 sessions █████████████
<= 300s: 19 sessions ███████████████████
<= 600s: 24 sessions ████████████████████████
A median of 156s for the first turn is unusually high. Simple prompts like navigating to a directory or asking a factual question should not take 2+ minutes.
<details>
<summary>Sessions with first turn > 120s (13 of 30 recent sessions)</summary>
| Session | Duration | Tool Calls | Prompt Type |
|---------|----------|------------|-------------|
| 1 | 312s | 10 | Analysis request |
| 2 | 302s | 11 | Session performance question |
| 3 | 196s | 16 | File reading request |
| 4 | 232s | 21 | Navigate to worktree + read MR |
| 5 | 188s | 16 | Find a file |
| 6 | 785s | 18 | Local command forwarded |
| 7 | 156s | 25 | Local command forwarded |
| 8 | 226s | 9 | GitLab issue link |
| 9 | 230s | 9 | Git tag link |
| 10 | 490s | 27 | Navigate to worktree + update |
| 11 | 210s | 19 | Local command forwarded |
| 12 | 527s | 24 | GitLab issue link |
| 13 | 444s | 25 | GitLab issue link |
Many of these are simple navigation or link-following requests that should complete in under 30s.
</details>
Context Configuration
The session has a large initial context that may contribute to slow startup:
| Component | Size |
|-----------|------|
| CLAUDE.md files | 175 lines (project + user) |
| Auto-loaded rules | 522 lines (10 files) |
| MEMORY.md index | 101 lines |
| MCP servers | 6 (each injects instruction text) |
| Registered skills | 40+ |
| Active hooks | 6 shell scripts |
| System-reminder injection | ~2,700 chars per message |
Reproduction
- Configure Claude Code with a large initial context (multiple CLAUDE.md files, rules, MCP servers, hooks)
- Start a new session
- Enter a simple prompt (e.g., "navigate to directory X")
- Observe: sometimes "Infusing..." hangs for minutes, sometimes no response at all
- Cancel (Escape) and re-enter the same prompt — usually works on second attempt
The issue is intermittent — the same configuration sometimes starts in 35s, sometimes hangs for 500s+, and occasionally never responds.
Root Cause Hypothesis
Possible causes (not mutually exclusive):
- MCP server initialization timeout: 6 MCP servers need to connect at session start. If one hangs, the entire session stalls.
- Hook execution during startup: 6 hooks run on session events. A slow or hanging hook could block processing.
- Race condition in prompt queue: The
queue-operationin the abandoned session suggests the prompt was enqueued but never dequeued for processing. - Context assembly timeout: Assembling 522 lines of rules + 175 lines of CLAUDE.md + MCP instructions may exceed an internal timeout.
Suggested Investigation
- [ ] Add timeout handling for MCP server initialization during session start
- [ ] Log which step of session initialization is slow (hooks? MCP? context assembly? API call?)
- [ ] Investigate why
queue-operation enqueuesometimes never leads to adequeue - [ ] Consider lazy-loading MCP server instructions (only when tools from that server are first used)
Workaround
Cancel (Escape) and re-enter the prompt. The second attempt usually works. No permanent fix known.
Environment
- Claude Code: v2.1.89
- Model: Opus 4.6 (1M context)
- Platform: VS Code Remote (Dev Container on WSL2)
- OS: Linux (WSL2)
Related
See #41903 (context compaction clears terminal scrollback) — same user, same configuration. Both issues are exacerbated by large initial context.
---
🤖 Generated with Claude Code
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗