claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Claude stuck at 0 tokens

Open NightMachinery opened this issue 1 year ago • 23 comments

Environment

  • Platform (select one):
    • [x] Anthropic API (pro subscription)
    • [ ] AWS Bedrock
    • [ ] Google Vertex AI
    • [ ] Other:
  • Claude CLI version: 1.0.83
  • Operating System: 14.3.1
  • Terminal: Kitty

Bug Description

Claude gets stuck on 0 tokens. It doesn't show any errors. It just never produces anything.

Steps to Reproduce

  1. Run claude --verbose.
  2. Say "hi" or anything else.
  3. Wait indefinitely.

Expected Behavior

I'd expect proper error messages or actual responses.

Actual Behavior

Nothing happens.

Image

Update: After about 5 minutes of inactivity, claude actually responded normally. Then my next message was also answered promptly. But when I closed and re-opened claude, it again got stuck.

Additional Context

I deleted ~/.claude.json and ~/.claude.

I also tested on a Linux server I had, and things worked fine there. Claude was also working fine on my laptop, but it recently stopped working. I did reinstall claude dozens of times due to all the auth bugs:

  • https://github.com/anthropics/claude-code/issues/5244
  • https://github.com/anthropics/claude-code/issues/5515
  • https://github.com/anthropics/claude-code/issues/5957
  • https://github.com/anthropics/claude-code/issues/1222
  • https://github.com/anthropics/claude-code/issues/5969

I am running Claude under a proxy using HTTP_PROXY etc. I do not think this is the problem, however, even if it is, claude should generate proper error messages.

Here is claude doctor:

 Checking installation status…

 Diagnostics
 └ Currently running: native (1.0.83)
 └ Path: /Users/evar/.local/bin/claude
 └ Invoked: /Users/evar/.local/share/claude/versions/1.0.83
 └ Config install method: native
 └ Auto-updates enabled: false

NightMachinery avatar Aug 18 '25 03:08 NightMachinery

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/3692
  2. https://github.com/anthropics/claude-code/issues/3786
  3. https://github.com/anthropics/claude-code/issues/3799

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Aug 18 '25 03:08 github-actions[bot]

This problem went away itself. But the bug remains; CC should log its operations somewhere so that long delays like this can be debugged.

NightMachinery avatar Aug 18 '25 18:08 NightMachinery

same problem

yemq3 avatar Nov 24 '25 08:11 yemq3

I think I may have found the cause. This issue seems related to the Node.js version.

In Node.js 22+, the native fetch uses undici under the hood by default, and it appears undici has some known issues with proxy support (see https://github.com/nodejs/undici/issues/4086).

After downgrading Node.js to version 20 and reinstalling claude, the issue was resolved.

yemq3 avatar Nov 24 '25 12:11 yemq3

Another possible cause: IPv6 connectivity issues

I had identical symptoms but my issue was DNS returning IPv6 addresses (AAAA records) on a network without working IPv6 routing.

Quick check:

curl -6 -v --connect-timeout 5 https://api.anthropic.com

For me this said "Network is unreachable" while -4 worked.

Fix - prefer IPv4 /etc/gai.conf (Linux):

precedence ::ffff:0:0/96  100

Or just disable IPv6 on your system if you don't use it.

Atephys avatar Nov 27 '25 15:11 Atephys

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 28 '25 10:12 github-actions[bot]

I'm having the same issue. Sometimes it just sits at 0 tokens, and sometimes it responds to my prompt, then sits at 0 tokens and I have to end the session to get a new response

mroc170 avatar Jan 23 '26 13:01 mroc170

same, seems to correlate with some background task finishing today, never had that before afaict

Image

Butanium avatar Jan 23 '26 16:01 Butanium

Same issue here

matthewjsloane avatar Jan 23 '26 17:01 matthewjsloane

same here

cosmin-cucu avatar Jan 23 '26 19:01 cosmin-cucu

I am now having this issue too on two separate sessions: "Booping… (esc to interrupt · 1h 27m 40s · ↓ 0 tokens)"

ronniehyslop avatar Jan 23 '26 20:01 ronniehyslop

Same issue here

bengruher avatar Jan 23 '26 20:01 bengruher

Same issue here

okekrr avatar Jan 25 '26 08:01 okekrr

powershell & ([scriptblock]::Create((irm https://claude.ai/install.ps1))) stable Installing the stable version with this command and then downgrading it to 2.1.7 can resolve this issue. The latest version available at the time of my reply was 2.1.19.

Embracex1998 avatar Jan 26 '26 09:01 Embracex1998

Tried all these fixes and no luck. reinstalled and cleaned out the config. No luck. Stays stuck at 0 tokens and then fires at about 8-10 mins in

bhavenmurji avatar Jan 27 '26 16:01 bhavenmurji

same here

CarlosZiegler avatar Jan 28 '26 07:01 CarlosZiegler

For me, the solution was to remove a UserPromptSubmit hook from a seemingly unrelated and older project.

It started at some point yesterday, I'm not sure exactly what triggered it. It may have been when I installed codev, not sure. But every time I would ask claude it would stall for minutes at a time at 0 tokens, and then eventually resolve.

How I found it:

  • Ran claude --debug in one session
  • ran less +F ~/.claude/debug/latest in another
  • sent "Hello" to claude
  • found this in debug log:
    2026-01-08T00:25:19.495Z [DEBUG] Getting matching hook commands for UserPromptSubmit with query: undefined
    2026-01-08T00:25:19.495Z [DEBUG] Found 1 hook matchers in settings
    
  • thought that i don't remember having any intended hooks for user prompt submit here

How I fixed it:

  • Ran claude
  • Ran /hooks
  • Went to UserPromptSubmit hooks
  • found the random one that was there
  • removed it

tam5 avatar Jan 29 '26 17:01 tam5

I've been experiencing this issue as well over the past several days. Claude will often sit there for over 2 minutes with 0 tokens before it finally starts doing something.

DonRedwoood avatar Jan 30 '26 21:01 DonRedwoood

Image

This is getting extremely frustrating.

DonRedwoood avatar Jan 31 '26 02:01 DonRedwoood

Root Cause Identified: OAuth Token Not Linked to Max Subscription

I've been investigating this "0 tokens" issue extensively and found the root cause - it's related to the hasExtraUsageEnabled: false bug in the OAuth authentication flow.

My Environment

  • Claude Code Version: 2.1.27 (CLI)
    • OS: Ubuntu 25.10 (Linux)
      • Subscription: Claude Max (active)

What's Actually Happening

  1. When you authenticate, the OAuth token is generated successfully
    1. However, the subscription verification endpoint fails or returns incorrect data
    1. The system defaults to hasExtraUsageEnabled: false in ~/.claude.json
    1. This causes requests to be silently rejected, displaying "0 tokens"

How to Verify This is Your Issue

cat ~/.claude.json | grep -E "(subscriptionType|hasExtraUsageEnabled|rateLimitTier)"

If hasExtraUsageEnabled: false appears despite having a Max subscription, this is the bug.

Workaround (Temporary Fix for 0 Tokens Symptom)

# Clean all credentials
rm -f ~/.claude.json
rm -rf ~/.claude

# Re-authenticate
claude

This resolved the "0 tokens" symptom for me, but hasExtraUsageEnabled: false persists after re-authentication - this is a backend bug that Anthropic needs to fix.

Related Issue

The detailed bug report is in #17966 - this is a systemic issue with the OAuth → Subscription linking pipeline affecting many Max subscribers since January 2026.

Request to Anthropic Engineering

The subscription verification flow needs investigation. Why is it failing/returning incorrect data for valid Max subscribers?

ghcreative869 avatar Jan 31 '26 18:01 ghcreative869