Skip to content

[Bug] OAuth token expiration causing repeated 401 authentication errors during active sessions #18225

Open

Description

@chrisvaillancourt

Bug Description
starting today, i keep getting a 401 error during my claude code sessions. i've been using claude code for months and only started getting this error today. I shouldn't need to re-run the /login command multiple times per day. i've gotten it 3 times in a <5 hour window. Error:

API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"OAuth token has expired. Please obtain a new token or refresh your existing token."},"request_id":"req_011CX7zT7Swc35VFkEUZ57Fo"} · Please run /login

Environment Info

  • Platform: darwin
  • Terminal: WarpTerminal
  • Version: 2.1.7
  • Feedback ID: c92426b9-6bb2-454d-98ba-1facb71112ca

Activity

  1. distractedCoding commented on Jan 14, 2026

    @distractedCoding

    Same for me

  2. raw1z commented on Jan 14, 2026

    @raw1z

    I'm experiencing the exact same issue since this morning

  3. jk-es335 commented on Jan 15, 2026

    @jk-es335

    In my case, I was getting a self-signed certificate error (OAuth error: self signed certificate in certificate chain), and I was able to work around it by running:

    NODE_TLS_REJECT_UNAUTHORIZED=0 claude

    and then executing /login.

    For reference.

  4. pierrevalade commented on Jan 16, 2026

    @pierrevalade

    same issue since this morning as well.

  5. nkovacic commented on Jan 28, 2026

    @nkovacic

    Cannot pinpoint when this started happening, but it seems to happen more frequently lately.
    Also, it seems to happen when a new Claude Code session is started in another repository while existing sessions still do not require re-authing.

  6. risenxxx commented on Feb 5, 2026

    @risenxxx

    Recently, I've started running into this every day when trying to continue a session. In the vscode extension chat, the sign-in screen displays immediately after I send a message. It's very annoying

  7. dkleecle commented on Feb 25, 2026

    @dkleecle

    Same, It makes me annoyting either

  8. NuntiusMortis commented on Apr 4, 2026

    @NuntiusMortis

    Same for me. I got a pro plan yesterday then have to deal with this issue Today, not a good thing.
    In my case I had to logout/login to Claude Agent on xCode to solve it.

  9. lucidbots-sean commented on Apr 6, 2026

    @lucidbots-sean

    Getting this persistently, even after /logout and /login

  10. hemanthreddy90 commented on Apr 7, 2026

    @hemanthreddy90

    same for me, even after trying multiple times I am not able to authenticate claude terminal

  11. garyilangreenberg commented on Aug 8, 2026

    @garyilangreenberg

    Adding a data point that may help narrow this down: on Claude Code v2.1.226 (macOS, native install, Claude Pro/subscription OAuth), this 401 is deterministically isolated to two specific project directories on my machine, while every other project works fine with the identical login/binary. /login completes without error but the 401 returns immediately on the next command, only in those two paths.

    Ruled out while diagnosing: stale terminal session (reproduces in a brand-new Terminal.app window), PATH/version mismatch (which claude / claude --version identical everywhere), project-level config (no .env/.mcp.json/.envrc/API-key refs in either project tree), IDE terminal integration (reproduces outside PhpStorm entirely), and path-based caching (symlinking the project to an unseen path still fails, so it appears to resolve to the real path first).

    Also found that macOS Keychain stores a separate Claude Code-credentials- entry per project (not one global entry) — deleted all ~18 of them via security dump-keychain | grep -i claude, ran claude update, did a fresh /login — the 401 still occurs identically in the same two project paths. /doctor also fails with the same API error instead of running its checks, and /feedback can't be submitted because it also needs working auth (hence commenting here instead).

    This points at server-side state keyed to specific project paths/identifiers on the account, surviving a full local credential wipe — hope it's useful for narrowing down the root cause.

    Update: Narrowed this down further — the issue tracks with the Claude Code version, not project state. Rolling back to v2.1.224 locally resolves the 401 in both previously-affected project paths, with everything else (login, keychain entries, binary location) held constant. Currently running v2.1.224 as a workaround while this gets sorted upstream.

  12. jonahbeckford commented on Sep 28, 2026

    @jonahbeckford

    Update: Narrowed this down further — the issue tracks with the Claude Code version, not project state. Rolling back to v2.1.224 locally resolves the 401 in both previously-affected project paths, with everything else (login, keychain entries, binary location) held constant. Currently running v2.1.224 as a workaround while this gets sorted upstream.

    I run into this as well when I use a docker container to run claude, when the host claude version is older than the container claude version. I strongly suspect that claude gives you eight hours to upgrade once it detects another claude has a newer version (or equivalently: the newer version of claude forces older versions to close gracefully) ... it is a pretty safe design when dealing with multiple versions of a client.

    Now i make sure any docker containers have claude versions that match the host.

    Related: I am not exactly sure if/login forces the upgrade, or if claude upgrades itself in the background, or both; either way, I saw after /login on the host that claude --version was a newer version from what /status shows in the host session. Regardless, a core problem is that the Login expired · Please run /login is quite misleading ... it should say Login required to use new version of Claude · Please run /login

  13. added
    bug
    platform:macos
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:authbugplatform:macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions