Fix a slow or stuck Claude Code

This page is for when Claude Code is already running but misbehaves: heavy CPU or memory, a freeze, compaction that keeps failing, odd characters, a clipboard that stays empty, or searches that find nothing. Start with the quick check, then jump to your symptom.

Start with the checkup

Run /doctor inside Claude Code. It checks your installation, settings, extensions and context usage, and proposes fixes it can apply after you confirm. If claude won't start at all, run claude doctor from your shell instead. /mcp shows the state of your MCP servers. For install and login errors, or settings and hooks that don't apply, the official docs have separate pages; our debugging guide covers the settings side.

High CPU or memory

  1. Run /compact regularly. If it answers Not enough messages to compact, the conversation has too few turns to summarize, which can happen even with a full context when one huge paste filled it.
  2. Close and restart Claude Code between big tasks.
  3. Add large build directories to your .gitignore.
  4. Restart with claude --safe-mode. It turns off all customizations for that session; if usage drops, a plugin, MCP server or hook is the cause, and the debugging guide shows how to find which.

If a session's memory passes 2.5 GB, a critical memory warning appears. Restart Claude Code and run claude --continue to resume the conversation in a fresh process. If memory stays high, /heapdump (type it in full; it is hidden from the command menu) writes two files to your Desktop: a heap snapshot and a -diagnostics.json.

Careful: the snapshot contains every string in the process, including your whole conversation and any credentials in it. Never attach it to a public issue or share it. The docs say to attach only the diagnostics file when you report a problem.

Compaction keeps failing: "Autocompact is thrashing"

This means compaction worked but a file or tool output refilled the context right away, several times in a row, so Claude Code stopped retrying. To recover:

  1. Ask Claude to read the big file in pieces, such as a line range or one function, not all of it.
  2. Run /compact with a focus that drops the large output, for example /compact keep only the plan and the diff.
  3. Move the large-file work to a subagent, which has its own context window.
  4. Run /clear if you don't need the earlier conversation.

If it comes back after /clear, run /context and compare the Messages row with the rest. If Messages is the biggest, a file or output is refilling the window, so repeat the steps above. If the other rows together are bigger, what loads at startup leaves too little room; see the context window and using less quota.

It freezes

Press Ctrl+C to cancel the current operation. If nothing responds, close the terminal and restart. You don't lose the conversation: run claude --resume in the same directory to pick the session back up.

Display problems

The clipboard stays empty

Searches find nothing

If the Search tool, @file mentions, custom agents or custom skills don't find files, the bundled ripgrep may not run on your system. Install your platform's package (for example brew install ripgrep on macOS, sudo apt install ripgrep on Ubuntu or Debian, winget install BurntSushi.ripgrep.MSVC on Windows), then set USE_BUILTIN_RIPGREP to 0, in your shell or in the env block of your settings.json:

{
  "env": {
    "USE_BUILTIN_RIPGREP": "0"
  }
}

Run claude doctor and check that the Search line shows your system ripgrep path, not OK (bundled). See which settings file wins if you are unsure where to put it.

Search on WSL returns too little

Reading files across the Windows and Linux file systems is slow on WSL, which can mean fewer matches than you expect. claude doctor still shows Search as OK. The docs suggest asking more specific searches (name a directory or file type), keeping your project on the Linux filesystem (/home/) rather than /mnt/c/, or running Claude Code natively on Windows.

Still stuck

Run /doctor and /mcp, use /feedback inside Claude Code to report a problem to Anthropic, or check the project's GitHub issues. For account, billing or subscription problems, contact Anthropic support instead.

This follows Anthropic's troubleshooting documentation as we read it in October 2026. We are not affiliated with Anthropic. We wrote this from the documentation and have not tested every case. Commands, limits and fixes change between versions, and where this page and the documentation disagree, the documentation wins. All the guides are in the guides index.

See also: Fix “command not found: claude” · Fullscreen mode: flicker and scrolling.

The free loop-stop skill gives long tasks a limit and a stop rule, which also keeps sessions from growing until they choke. If you want a second pair of eyes on your CLAUDE.md and settings, the Tune-Up Kit is a checklist for exactly that.