anthropics / anthropics/claude-code
[BUG] claude spins at 100% CPU indefinitely on startup — regression between 2.1.112 and 2.1.113
- Dominant language
- Python
- Stars
- 145k
- Forks
- 23.1k
- PR merge metrics
- PR metrics pending
Description
### Preflight Checklist
- [x] I have searched [existing issues](https://github.com/anthropics/claude-code/issues?q=is%3Aissue%20state%3Aopen%20label%3Abug) 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?
Running `claude` (or any subcommand except `--version`, e.g. `claude doctor`, `claude --debug`) causes the process to spin at 100% CPU indefinitely and never return. The process stays in state `R` (running, not sleeping/blocked) the entire time. Ctrl+C (SIGINT) does not stop it — it requires `kill -9`.
`claude --version` works fine and returns instantly, so this is specific to the full startup path.
I bisected this across the 2.1.x release line and found the regression starts precisely at 2.1.113:
| Version | Result |
|---|---|
| 2.0.0 | Works |
| 2.1.0 | Works |
| 2.1.100 | Works |
| 2.1.112 | Works |
| 2.1.113 | Hangs |
| 2.1.125 – 2.1.274 | Hangs (all tested) |
Before concluding this was a code regression, I ruled out every environment-level cause I could think of:
- Network: `tcpdump` showed zero packets during the hang; `strace` showed no socket file descriptors at all.
- DNS: all required hostnames resolve correctly via local and public (8.8.8.8) resolvers.
- Terminal/tty: `stty -a` normal (`time = 0`), `TERM=xterm-256color`, stdin/stdout confirmed real ttys.
- Locale: `LANG=C.UTF-8`, no errors.
- CPU steal time: ~0.5% via `top`/`vmstat`, so not a hypervisor/host oversubscription issue.
- Stale config/state: reproduces identically with `~/.claude/` fully removed (directory absent, not just emptied).
- System clock: synchronized, correct UTC.
- Install method: reproduces identically via the native installer, npm, and apt.
- Env vars: `CLAUDE_CODE_OAUTH_TOKEN` and other `CLAUDE_*` vars checked, not a factor here.
`strace -f -p ` shows threads parked in `futex(FUTEX_WAIT_PRIVATE, ...)` and a main thread cycling through `restart_syscall`/`read` with periodic `ETIMEDOUT` on a ~30s cadence on the tty fd — looks like a busy-retry loop rather than a genuine blocking wait.
Possibly related to #87554 and #87553 (100% CPU spin + unresponsive SIGINT, Bun runtime).
### What Should Happen?
`claude` and its subcommands should start normally within a few seconds and use minimal CPU while idle/waiting for input, as they do in 2.1.112 and earlier.
### Error Messages/Logs
```shell
No error output is produced — the process simply hangs silently at 100% CPU with no stdout/stderr after "Setting up Claude Code..." (native installer) or immediately on `claude doctor` (once already installed).
Process snapshot during the hang:
user 109947 45.2 0.6 5556248 109824 pts/3 Tl 14:22 0:43 claude doctor
user 110111 100 0.6 5556312 109824 pts/3 Rl+ 14:23 0:31 claude doctor
```
### Steps to Reproduce
1. On Linux, install Claude Code 2.1.113 or later via npm:
npm install -g @anthropic-ai/claude-code@2.1.113
2. Run:
claude doctor
3. Observe: process hangs indefinitely at 100% CPU, no output, Ctrl+C does not stop it (requires kill -9)
To confirm the regression boundary:
4. npm install -g @anthropic-ai/claude-code@2.1.112
5. claude doctor
6. Works correctly — starts normally within a few seconds
### Claude Model
None
### Is this a regression?
Yes, this worked in a previous version
### Last Working Version
2.1.112
### Claude Code Version
2.1.274 (Claude Code) — also reproduces on every version from 2.1.113 through 2.1.274 tested
### Platform
Anthropic API
### Operating System
Ubuntu/Debian Linux
### Terminal/Shell
Other
### Additional Information
Environment:
- OS: Ubuntu, kernel 6.8.0-31-generic
- Virtualization: KVM (VPS)
- Node: v24.21.0 (via nvm)
- Reproduces via native installer (curl -fsSL https://claude.ai/install.sh | bash), npm, and apt — all identical
Full bisection performed manually across 2.0.0 → 2.1.274 to isolate the exact regression point (2.1.112 → 2.1.113).
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the hang with `claude doctor` on Ubuntu/Debian using versions 2.1.112 and 2.1.113, then compare the startup path with `claude --version`. Use the reported `strace` and process-state observations to narrow the regression. Done means normal startup within seconds, low CPU while idle, and responsive Ctrl+C handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, linux, node.js
- Domain
- cli, operating-systems, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100