Skip to content

Authentication token expiration causes request failures even after re-authentication #15137

Closed as not planned

Description

@matthieu-labs

Description:

Since approximately 3 days ago, I'm experiencing a critical authentication issue where session token expiration consistently causes request failures, even after successful re-authentication.

Bug Behavior:

  1. Session token expires during normal usage (403 error: "The security token included in the request is expired")
  2. Claude Code automatically attempts to re-authenticate (shows retry attempts: 1/10, 2/10, etc.)
  3. Re-authentication appears to succeed
  4. However, the original request still fails with the same token expiration error
  5. This pattern repeats on every session expiration

Expected Behavior:
After successful re-authentication, the original request should be retried and succeed, not continue to fail with the same token expiration error.

Frequency:
This happens every single time a session expires - 100% reproduction rate.

Timeline:

  • Started: Approximately 3 days ago (around December 20, 2025)
  • Prior behavior: This issue did not occur before; re-authentication worked correctly

Environment:

  • Tool: Claude Code CLI
  • Model: claude-sonnet-4-5-20250929 (EU)
  • Platform: macOS (Darwin 24.6.0)
  • Date: December 23, 2025

Impact:
This forces manual intervention on every session expiration, significantly disrupting workflow and making the tool unreliable for longer sessions.

Suspected Cause:
The re-authentication mechanism appears to refresh the token, but the original failed request may not be properly retrying with the new token, instead continuing to use the expired token.

Activity

  1. added
    bug
    has repro
    platform:macos
    on Dec 23, 2025
  2. github-actions commented on Dec 23, 2025

    @github-actions

    Found 3 possible duplicate issues:

    1. Bug: /login Does Not Recover Active Session After OAuth Token Expiration #15007
    2. [BUG] OAuth token expiration disrupts autonomous workflows – refresh token handling needed #12447
    3. OAuth expiration causes retry storm consuming 100% session usage (3.75M wasted tokens) #10784

    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

  3. matthieu-labs commented on Dec 23, 2025

    @matthieu-labs
    Author

    👎 issue not the same - as #10784 - please look into this

  4. MWatter commented on Jan 7, 2026

    @MWatter

    A little more context for this:

    1. Have CC be in in non-bedrock mode (i.e. no "CLAUDE_CODE_USE_BEDROCK": "1" in the environment or settings.json).
    2. Start it. Even with no API key or login it's fine, just starting it is all you need.
    3. Prompt "Hello". It's fine if the prompt fails with no API key or or no /login
    4. Set the AWS keys and token in the environment or settings.json and add "CLAUDE_CODE_USE_BEDROCK": "1"
    5. This should work. Now use the agent until expiration or simply wait
    6. When you get a 403 The security token included in the request is expired, exit CC
    7. Get a new set of keys and token (or maybe just a token) and set them appropriately.
    8. Restart CC
    9. Send a prompt; if you are experiencing the issue (and everyone on my team is), you will STILL get the 403 The security token included in the request is expired even with the new token
    10. Exit CC and remove or unset "CLAUDE_CODE_USE_BEDROCK": "1"
    11. Start CC and send a prompt. Likley fail but with the normal no API key or /login message
    12. Exit CC again and re-add "CLAUDE_CODE_USE_BEDROCK": "1"(recall that you already set the new AWS keys and token and haven't changed them - you only told CC not to use bedrock)
    13. Start CC again and issue a prompt. Works fine and is correctly hitting bedrock again.

    Somewhere, CC is storing the old token and not passign it to the current or new sessions until you actually disable bedrock mode entirely.

    Perhaps it's this same problem that is the cause of #12421 as well.

  5. m-cla-trip commented on Jan 7, 2026

    @m-cla-trip

    @MWatter thanks for your reply and support! I just got it back to running again, the reason the security token was not taken over after re-auth, was that i had a wrong profile configured in my aws config file or better said, the profile that had worked in the past, was removed. Unfortunately therefore, i can not say, wether your solution would have helped my issue. Many thanks for your reply!! Much appreciated!

  6. github-actions commented on Feb 7, 2026

    @github-actions

    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.

  7. added
    autoclose
    on Feb 7, 2026
  8. github-actions commented on Feb 21, 2026

    @github-actions

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

  9. github-actions commented on Mar 1, 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.

  10. locked as resolved and limited conversation to collaborators on Mar 1, 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:authautoclosebughas reproplatform:macos

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions