Skip to content

Frequent 401 Authentication Errors Requiring Re-login #40830

Closed as not planned
Closed as not planned

Description

@Omrigotlieb

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"},"request_id":""}

This forces me to re-authenticate repeatedly and significantly disrupts my workflow.

Impact:

Happens every few minutes
Interrupts ongoing tasks
Makes the tool very difficult to use reliably

Environment:

Using Claude Code
Max subscription plan
(Add OS / terminal / version if relevant)

What Should Happen?

Expected behavior:
Authentication should persist, and I should not need to log in repeatedly during active usage.

Actual behavior:
Session appears to expire or become invalid frequently, requiring /login again.

Additional context:
This happens consistently during normal usage, not after long idle periods.

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce:

Open Claude Code in the terminal
Log in using /login
Start working normally (e.g., run prompts, edit code, or interact with the agent)
Continue working for a few minutes

Observe that the session becomes invalid and the following error appears:

Please run /login · API Error: 401 {"type":"error","error":{"type":"authentication_error","message":"Invalid authentication credentials"},"request_id":""}
Re-run /login
Repeat steps 3–5

If you want to make it stronger (more “engineer-proof”), you can add:

Reproducibility: 100% (or “very frequent”)
Workaround: Re-running /login, but issue recurs within minutes

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.87

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Image

Activity

  1. added
    bug
    on Mar 30, 2026
  2. added
    platform:macos
    on Mar 30, 2026
  3. github-actions commented on Mar 30, 2026

    @github-actions

    Found 3 possible duplicate issues:

    1. OAuth token expires every ~10 minutes (was ~1 week) #37804
    2. [BUG] OAuth token expires excessively — multiple times per day #36911
    3. [BUG] 401 after successful /login on 2.1.87 — token not persisting FOR 12+ hours and 10+ attempts with success print #40473

    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

  4. Omrigotlieb commented on Mar 30, 2026

    @Omrigotlieb
    Author

    @bcherny , I genuinely admire your posts and your way of thinking. You consistently bring clarity and depth to the developer tooling space.

    I wanted to raise this because I believe it reflects a broader issue, not just an isolated case. I am seeing frequent 401 authentication errors in Claude Code that force me to run /login again and again, sometimes every few minutes. From the reports I’ve seen, other users appear to be experiencing similar behavior.

    This has a real impact on usability. It interrupts active workflows, breaks concentration, and makes long coding sessions much harder than they should be. In practice, repeated auth failures turn a powerful tool into something difficult to rely on for sustained engineering work.

    I’m a paying Max user and I want to use Claude Code heavily, but this issue creates constant friction during normal usage. Authentication should be stable enough that users can stay focused on building, not repeatedly re-establishing a session.

    I’d really appreciate it if you and the team could investigate and address this. Claude Code has huge potential, but persistent re-login loops are the kind of reliability issue that can seriously damage the experience for power users.

    Please help Claude Code remember me for longer than a few minutes :)

  5. added
    stale
    on Apr 18, 2026
  6. github-actions commented on May 2, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  7. github-actions commented on Jun 21, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  8. locked as resolved and limited conversation to collaborators on Jun 21, 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:macosstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions