Home › Claude Code › Errors › Hangs / stuck
OverviewInstallCLI referencePricing & limitsAgent SDKSkills & pluginsGitHubWeb, desktop & IDEModelsErrorsOpen source?TutorialFor studentsQA automationvs Cursorvs Codex & OpenCodeSubagentsHooksMCPEcosystemVS CodeOpenRouterRate limits中文指南
Last updated: September 30, 2026

Claude Code hangs, gets stuck or stops responding: how to find out where it is stuck and get out

A hang has a location: Claude Code is waiting on the API, on a tool it launched, on an MCP server, on your terminal, or on itself. The escape route differs for each, and the status line usually tells you which one it is before you reach for kill.

TLDR

  • Waiting on the API → a spinner with a token count or a *Waiting for API response* line; a connection problem, not a hang.
  • Waiting on a tool → the tool line stays open; Esc cancels it. A shell command waiting for input or a runaway grep is the usual cause.
  • Waiting on you → an approval or question prompt hidden off-screen; press Enter or scroll.
  • Truly hung (no output, no reaction to Esc, Ctrl+C) → kill the process and resume with claude -c; check the known bugs below.

Where is it stuck? Read the screen, then the process

# in the session
Esc            # cancel the current tool or turn
Ctrl+C (twice) # abort the turn / exit
# from another terminal
ps aux | grep -E "claude|node" | grep -v grep     # child processes still running?
top -o cpu       # is claude spinning or idle?
claude --debug   # next time: timestamps for every request and tool call
claude -c        # resume the last session after a kill

Idle CPU with a frozen prompt means it is waiting on something external: a network stream, an MCP server, a child process, a prompt you cannot see. Pinned CPU means it is working on something internal: parsing a huge tool result, a regex backtracking, a large session being loaded. Memory climbing steadily means a tool result or session file is being swallowed whole.

Known causes on the tracker

  • `/rewind` hangs, `Ctrl+C` ignored, `kill -9` needed (#53011, 21 reactions, on sessions of any size in the 2.1.1xx builds). An Anthropic engineer could not reproduce on 2.1.233, so update first; on an older build, kill the process and resume with claude -c instead of rewinding.
  • Remote Control sessions freeze mid-execution and only a local `Esc` revives them (#51267, open). Any tool or subprocess that blocks freezes the whole remote session with no remote cancel; keep such sessions short, and avoid tools that may prompt.
  • MCP authentication prompt hangs on `Enter` (#42707, open). Authenticate the server from a separate claude mcp command or the browser, then restart the session.
  • `grep` through the embedded matcher eats all memory (#54394): on native builds every shell grep runs inside a claude process with its own V8 heap; a backtracking regex over a long minified line balloons to gigabytes and the OOM killer takes the session with it, on WSL2 and Linux alike. Avoid unbounded regexes over minified files, exclude build output and node_modules, or install system ripgrep and call it explicitly.
  • Stuck retry loop on `400 thinking blocks cannot be modified` (#63231) — the conversation history is invalid and every retry fails the same way. /rewind to before the turn, or /clear; see the 400 guide.
  • **Cloud / scheduled runs stuck on *Setting up a cloud container*** (#53691, #54528) — service-side; nothing local, cancel and check status.claude.com.
  • Large session resume takes minutes — the transcript is replayed at start. Resume the specific session you need (claude -r) rather than the largest, and let compaction shrink monsters.

Hangs at startup

A blank screen right after claude with no prompt is usually the first API call not returning: a proxy variable pointing at a dead proxy, a VPN, DNS, or an unreachable ANTHROPIC_BASE_URL. Run the curl check from the connection errors guide, then claude doctor. Slow startups with a prompt eventually appearing are MCP servers being launched; claude mcp list and remove the ones that time out.

Child processes that never exit

A shell tool that opens an editor, waits for a password, tails a log or starts a dev server never returns, and the turn waits for it. Tell the agent to run servers in the background and to add --no-pager, -y or < /dev/null where a command might prompt. If it has already happened, Esc cancels the tool; if the child ignores that, kill it by PID from another terminal and the turn continues with the error.

High memory and CPU

  • Tool results are kept in memory and on disk for the session; reading a 200 MB file is a 200 MB session. Read the parts you need.
  • Many parallel subagents multiply everything; CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY=2 on small machines.
  • Terminal emulators with slow rendering (some Windows consoles, remote tmux over a thin link) make streaming output look frozen; claude --debug shows whether tokens are still arriving.
  • If memory climbs while idle, look for leftover claude processes from crashed IDE sessions and kill them (process exited with code 1 covers the Windows orphan case).

When it is the API, not the client

A session that hangs on every turn at the same point, with a small spinner and an eventual retry line, is a slow or dropping API path rather than a client bug: 529 overloaded, server-side throttling or a reset connection. Through a gateway (ANTHROPIC_BASE_URL=https://aiprimetech.io) a saturated upstream account is failed over to another, which shortens exactly these stalls.

Tired of fighting this one?

Run Claude Code through the AI Prime Tech gateway instead: the same Claude models on the gateway's own upstream accounts, two environment variables to switch, and new accounts get $5 in free API credit with code FIXIT — no card.

export ANTHROPIC_BASE_URL=https://aiprimetech.io
export ANTHROPIC_API_KEY=your_key

Create an account with code FIXIT

Frequently asked questions

Why is Claude Code stuck and not responding?

It is waiting on something: an API stream, a tool it launched, an MCP server, or an approval prompt off-screen. Press Esc to cancel the tool, Ctrl+C twice to abort; if nothing reacts, kill the process and resume with claude -c.

How do I fix Claude Code hanging on /rewind?

Update to a current build; the hang was reported on 2.1.1xx and Anthropic could not reproduce it on 2.1.233. On an old build, kill the process and use claude -c instead of /rewind.

Why does Claude Code use so much memory?

Large tool results and session transcripts are kept whole, subagents multiply them, and on native builds a backtracking grep regex runs inside a claude process with a large V8 heap. Read less, exclude build output, lower concurrency.

Claude Code hangs on startup with no prompt. What do I check?

The first API request is not returning: proxy variables, VPN, DNS or an unreachable ANTHROPIC_BASE_URL. Run a curl against the endpoint, then claude doctor, and remove MCP servers that time out.

Run Claude Code on the gateway

Same models, two environment variables, credits at 7.69× face value — or a flat-rate unlimited plan. New accounts: $5 in free API credit with code FIXIT.

Get an API key See unlimited plans

AI Prime Tech is an independent API gateway and is not affiliated with, endorsed by, or sponsored by Anthropic. “Claude” and “Claude Code” are trademarks of Anthropic. Claude Code features described here follow Anthropic’s public documentation at the time of writing and change frequently; prices and model lists on this page are read from this gateway’s live settings.

More Claude Code guides

Claude Code errors and how to fix themClaude Code "API Error: 500": what it means and what actually fixes itClaude "Overloaded" error (API Error 529): what it means and what to doClaude Code API Error 400: prompt is too long, tool use concurrency, and the restClaude Code OAuth errors: timeout of 15000ms exceeded, and status code 500"Claude Code process exited with code 1": how to find the real error and fix itClaude "Prompt is too long", "input is too long for requested model" and "Context limit reached": what fills the window and how to get it backClaude usage limit reached: session, weekly and Opus limits, "specified API usage limits", "credit balance is too low" — and what to doClaude Code 401 and 403: invalid authentication credentials, invalid API key, "Not logged in", host_not_allowedClaude Code connection errors: ECONNRESET, connection lost mid-response, "Waiting for API response", "Unable to connect to API", SSL certificate errorsClaude.ai not working: "Something went wrong", capacity constraints, "5-hour limit reached", "error logging you in" and the rest