Claude Code freezes during API call ("Befuddling" spinner), terminal becomes completely unresponsive

Resolved 💬 9 comments Opened Feb 10, 2026 by jlmalone Closed May 24, 2026

Bug Description

Claude Code occasionally freezes mid-execution during the "thinking" phase (shows spinner text like "Befuddling..." or similar). The terminal becomes completely unresponsive — no keyboard input is accepted, including Ctrl-C. The only recovery is force-killing the process (kill -9), which destroys the entire session context.

This has happened multiple times across different sessions doing the same type of work (ADB-based automation tasks with repeated Bash tool calls).

Environment

  • Claude Code version: 2.1.38 (also observed on 2.1.37)
  • Model: Opus 4.6 (1M context)
  • OS: macOS Darwin 24.1.0 (Apple Silicon)
  • Shell: zsh
  • Mode: --dangerously-skip-permissions (but also observed without it)

Steps to Reproduce

  1. Start a Claude Code session
  2. Have it execute a series of Bash tool calls (e.g., ADB commands, shell scripts)
  3. After several successful tool calls in a loop, Claude enters the thinking/spinner phase
  4. The spinner shows briefly (e.g., "Befuddling... (1m 56s · ↑ 2.3k tokens · thought for 1s)")
  5. The session freezes completely — no further output, no keyboard response

Observed Behavior

  • The Claude Code process (Node.js) remains alive in S+ state (sleeping, foreground)
  • It does not respond to SIGINT (kill -INT) — Ctrl-C equivalent has no effect
  • Only SIGKILL (kill -9) terminates it
  • The spinner metadata shows a long elapsed time (1m56s) but minimal thinking time (1s), suggesting the process is stuck waiting on an API response that never arrives
  • A zombie child process (<defunct>) was observed under the Claude process, created ~1 minute after session start

Diagnostic Data

Process state when frozen:

PID  PPID STAT TTY      COMMAND
63511 ... S+   ttys019  claude --dangerously-skip-permissions

Child processes:

63516 63511 S+   npm exec @modelcontextprotocol/server-github
63517 63511 S+   uvx ... voice-mode
63528 63511 S+   sourcekit-lsp
63634 63511 Z+   <defunct>   # zombie child

The zombie child (PID 63634) was created at 03:40:31, about 1 minute after the Claude session started (03:39:46). It's possible this zombie is related to the hang — perhaps a shell command that completed but wasn't properly reaped, causing the event loop to stall.

Hypotheses

  1. API connection timeout not handled: The underlying HTTP connection to the Anthropic API may have dropped (TCP RST, network blip, server-side timeout) but the client doesn't have a proper timeout/retry, causing it to wait indefinitely on a socket that will never respond.
  1. Zombie child process causing event loop stall: The defunct child process suggests a spawned subprocess exited but was never waited on. In Node.js, if the close event for a child process pipe isn't properly handled, it could block the event loop or leave the process in a state where it can't process new events (including signals).
  1. MCP server communication deadlock: With multiple MCP servers running (GitHub, VoiceMode, SourceKit-LSP), there could be a deadlock where Claude Code is waiting for a response from an MCP server while the MCP server is waiting for something from Claude Code.
  1. SIGINT handler not registered or overridden: The fact that SIGINT has no effect suggests either the signal handler is not properly set up, or the process is stuck in a system call that doesn't check for pending signals (though this is less common in Node.js).

Frequency

This has happened 3+ times in the last 24 hours, always during sessions with intensive Bash tool usage (many sequential shell commands). It does NOT happen during idle sessions or purely conversational sessions.

No Viable Workaround

The only way to recover is kill -9 <pid>, which completely destroys the session and all accumulated context. This is not a workaround — it's total data loss. For long-running autonomous sessions with extensive conversation history and in-progress multi-step workflows, this means hours of work and context are irretrievably lost. The session cannot be resumed, checkpointed, or recovered.

Expected Behavior

Claude Code should:

  1. Have timeouts on API calls so it doesn't hang indefinitely
  2. Remain responsive to Ctrl-C (SIGINT) even during API calls
  3. Properly reap child processes to avoid zombies
  4. Ideally support session persistence/recovery so a crash doesn't mean total context loss

View original on GitHub ↗

This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗