Claude subscription token expires after a period of time #4047

Open
opened 2026-02-16 17:42:24 -05:00 by yindo · 13 comments
Owner

Originally created by @leeweisern on GitHub (Dec 31, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Usually it happens when i stopped using for a while. e.g: 12 hours. The first session i talk to Claude, I will get Error: Token refresh failed: 400

i have to type something random, and then it works. This is a minor issue, but i am using opencode as a remote agent. So it affects the user experience.

From what i am seeing, the token expires, it throws the errors but the refresh token actually succeeds.

So the user have to manually send another message for it to continue.

Image

OpenCode version

1.0.220

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Originally created by @leeweisern on GitHub (Dec 31, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Usually it happens when i stopped using for a while. e.g: 12 hours. The first session i talk to Claude, I will get `Error: Token refresh failed: 400` i have to type something random, and then it works. This is a minor issue, but i am using opencode as a remote agent. So it affects the user experience. From what i am seeing, the token expires, it throws the errors but the refresh token actually succeeds. So the user have to manually send another message for it to continue. <img width="1584" height="1036" alt="Image" src="https://github.com/user-attachments/assets/0072d69a-657d-420d-9019-8d0015e77cb1" /> ### OpenCode version 1.0.220 ### Steps to reproduce _No response_ ### Screenshot and/or share link _No response_ ### Operating System _No response_ ### Terminal _No response_
yindo added the bug label 2026-02-16 17:42:24 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 31, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #4992: Getting "Unauthorized: token expired" during conversation - Similar token expiration issue during active sessions
  • #6083: Token refresh failed: 403 failed with github copilot - Token refresh failures with Anthropic/GitHub Copilot providers

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 31, 2025): This issue might be a duplicate of existing issues. Please check: - #4992: Getting "Unauthorized: token expired" during conversation - Similar token expiration issue during active sessions - #6083: Token refresh failed: 403 failed with github copilot - Token refresh failures with Anthropic/GitHub Copilot providers Feel free to ignore if none of these address your specific case.
Author
Owner

@aldaw commented on GitHub (Jan 3, 2026):

I got the same error after around 10 hours, laptop and my self went to sleep. And then I get this error at first prompt.
Image

@aldaw commented on GitHub (Jan 3, 2026): I got the same error after around 10 hours, laptop and my self went to sleep. And then I get this error at first prompt. <img width="1048" height="136" alt="Image" src="https://github.com/user-attachments/assets/c9749fbf-5f95-4e22-8176-55b302756f6b" />
Author
Owner

@n2k3 commented on GitHub (Jan 5, 2026):

Same for me for new sessions after a while (usually next day)

Image

I have to re-prompt for it to actually refresh the token.

@n2k3 commented on GitHub (Jan 5, 2026): Same for me for new sessions after a while (usually next day) <img width="327" height="269" alt="Image" src="https://github.com/user-attachments/assets/6f6664a3-dd78-4f21-b1a3-fffc7b0f6564" /> I have to re-prompt for it to actually refresh the token.
Author
Owner

@drjagan commented on GitHub (Jan 13, 2026):

I have the same issue. Re-Prompting did not help.

@drjagan commented on GitHub (Jan 13, 2026): I have the same issue. Re-Prompting did not help.
Author
Owner

@mehow28 commented on GitHub (Jan 14, 2026):

Just had this issue - re-prompting did not help, had to re-connect provider (claude - opencode dekstop win11 25H2)

@mehow28 commented on GitHub (Jan 14, 2026): Just had this issue - re-prompting did not help, had to re-connect provider (claude - opencode dekstop win11 25H2)
Author
Owner

@pranshuchittora commented on GitHub (Jan 14, 2026):

Encountered the same,
Image

Now my morning routine includes re-login.

@pranshuchittora commented on GitHub (Jan 14, 2026): Encountered the same, <img width="472" height="71" alt="Image" src="https://github.com/user-attachments/assets/cc704baa-ef55-47bd-afc6-903b7929ab99" /> Now my morning routine includes re-login.
Author
Owner

@bzbetty commented on GitHub (Jan 14, 2026):

I hit this most days too, which unfortunately is often followed by #8529 which makes it a bit more of a chore to re-login

@bzbetty commented on GitHub (Jan 14, 2026): I hit this most days too, which unfortunately is often followed by #8529 which makes it a bit more of a chore to re-login
Author
Owner

@simonsankar commented on GitHub (Jan 16, 2026):

how long does it last? is this meant to happen from Anthropic's side? that it expires?

@simonsankar commented on GitHub (Jan 16, 2026): how long does it last? is this meant to happen from Anthropic's side? that it expires?
Author
Owner

@xtfer commented on GitHub (Jan 21, 2026):

Not sure that just closing the patch and walking away is going to fly...

@xtfer commented on GitHub (Jan 21, 2026): Not sure that just closing the patch and walking away is going to fly...
Author
Owner

@iamkhullar commented on GitHub (Jan 22, 2026):

i face this issue multiple times in past few days - goto opencode cli > have to connect the provider again > authenticate claude and then restart the opencode app - this fixes it but for some time

@iamkhullar commented on GitHub (Jan 22, 2026): i face this issue multiple times in past few days - goto opencode cli > have to connect the provider again > authenticate claude and then restart the opencode app - this fixes it but for some time
Author
Owner

@prolific commented on GitHub (Feb 7, 2026):

Facing the same issue. This is getting very annoying.

@prolific commented on GitHub (Feb 7, 2026): Facing the same issue. This is getting very annoying.
Author
Owner

@AbeShunyah commented on GitHub (Feb 13, 2026):

same.

i need to always delete Anthropic provider and add it again. This is not good experience.

@AbeShunyah commented on GitHub (Feb 13, 2026): same. i need to always delete Anthropic provider and add it again. This is not good experience.
Author
Owner

@akarabach commented on GitHub (Feb 16, 2026):

the same

@akarabach commented on GitHub (Feb 16, 2026): the same
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4047