You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Getting "Unauthorized: token expired" during conversation #4992
During normal interaction while the agent is working / responding, it will occasionally abruptly stop with a red bordered message that just says "Unauthorized: unauthorised: token expired". I'm using Github Copilot as the provider, and seen it happen on Claude-Sonnet-4.5 for certain.
All I have to do is say "carry on" or similar, and it continues fine.
Only observed this in the last couple of days, I believe it only started since around the version that introduced support for GPT-5.1-codex via Githob Copilot (i.e., the API endpoint change)... nnot that I'm using that model at the moment.... hope that helps?!
I appreciate this is intermittent, perhaps only 2-3 times today of pretty much constant use. Is there any useful settings or command line parameters that I could use, to help catch some details when/if it happens again?
OpenCode version
1.0.126
Steps to reproduce
Talk to the agent. I can't say if there is any specific trigger, it has happened while delegating to a sub-agent as well as a straight forward single agent interaction.
Hm any chance you are using copilot on multiple platforms at the same time (ex: vscode + opencode same time)? I heard some people say that the copilot api sometimes invalidates other refresh tokens or something
i'm experiencing the same issue. it seems to have started around the 1.120–1.122 updates.
i'm using opencode and sometimes copilot in vscode for small fixes. however, i can't say there's a direct connection between using copilot in vscode and the opencode copilot session expiring. if there is a relation, it's not immediate — the opencode session does not expire right after i use copilot in vscode.
I don't know if it is related to any recent updates, I talked to several people in discord who seemed to say this has always been a thing, annoyingly no one opened issues recently lol
i can assure you this only started recently. I’ve been using the copilot provider the entire time I’ve used opencode, and until now it was fine.
at the moment, though, I have to log in again every 20–30 minutes. For example, just now I was waiting for copilot/opus 4.5 to respond, asked it one more question right after, and immediately got an “unauthorized” error.
when I first started using opencode, I logged in once and didn’t have to touch auth again until these recent issues started ☹️
and i also don't know if it related to some updates, maybe this is just a coincidence that i noticed it after 1.120
i think i didn't try to send follow ups when this issue occurs, i just log in again
strange that i didnt tried that, will try and write to you, thank yo
Not actively using github copilot in multiple places, but Visual Studio was open, I wasn't interacting with Github Copilot there.
yes, I tried that, it did happen again afterwards (not straight away)
it doesn't 'automatically' recover, but all I have to do is just send a message, I say something like 'carry on', and it does.
I can confirm as @moddi3 mentioned, this didn't occur to me until recently, and I've been working on this specific project for 2+ months, hours and hours a day inside opencode.
@moddi3 whereas I can send follow ups, and it immediately continues where it left off.
I've actually had a couple of days without touching it, but I'll keep an eye out for any more occurrences on the latest versions.
Happened again, v1.0.133 - only using Github Copilot Claude Opus 4.5 - no delegation happening, just a single agent. Not using any other instances of Github Copilot anywhere.
And simply prompting it again, continues without missing a beat. (other that that 'token expired' one)
Activity
github-actions commentedon Dec 2, 2025
This issue might be a duplicate of existing issues. Please check:
AI_APICallError: Bad Request#2764: Session turns keeps resulting inAI_APICallError: Bad Request- Similar intermittent errors during agent conversation turnsFeel free to ignore if none of these address your specific case.
rekram1-node commentedon Dec 2, 2025
Hm any chance you are using copilot on multiple platforms at the same time (ex: vscode + opencode same time)? I heard some people say that the copilot api sometimes invalidates other refresh tokens or something
rekram1-node commentedon Dec 2, 2025
@grahamcropley have you tried opencode auth login and then doing copilot again?
rekram1-node commentedon Dec 2, 2025
does it automatically recover? Or how did you resolve it
moddi3 commentedon Dec 3, 2025
i'm experiencing the same issue. it seems to have started around the 1.120–1.122 updates.
i'm using opencode and sometimes copilot in vscode for small fixes. however, i can't say there's a direct connection between using copilot in vscode and the opencode copilot session expiring. if there is a relation, it's not immediate — the opencode session does not expire right after i use copilot in vscode.
rekram1-node commentedon Dec 3, 2025
I don't know if it is related to any recent updates, I talked to several people in discord who seemed to say this has always been a thing, annoyingly no one opened issues recently lol
moddi3 commentedon Dec 3, 2025
i can assure you this only started recently. I’ve been using the copilot provider the entire time I’ve used opencode, and until now it was fine.
at the moment, though, I have to log in again every 20–30 minutes. For example, just now I was waiting for copilot/opus 4.5 to respond, asked it one more question right after, and immediately got an “unauthorized” error.
moddi3 commentedon Dec 3, 2025
when I first started using opencode, I logged in once and didn’t have to touch auth again until these recent issues started☹️
and i also don't know if it related to some updates, maybe this is just a coincidence that i noticed it after 1.120
rekram1-node commentedon Dec 3, 2025
Hm this is very strange, I use copilot exclusively in opencode and haven't had to login since the first time I did
rekram1-node commentedon Dec 3, 2025
Are you sure you have to reauth everytime? You can't send followups? Other people said it would handle it after sending a followup automatically
moddi3 commentedon Dec 3, 2025
i think i didn't try to send follow ups when this issue occurs, i just log in again
strange that i didnt tried that, will try and write to you, thank yo
moddi3 commentedon Dec 3, 2025
i cant send follow ups when this issue happens
moddi3 commentedon Dec 5, 2025
It no longer logs me out, since yesterday evening, maybe it is github's issue?
i did not update opencode all this time
grahamcropley commentedon Dec 5, 2025
@rekram1-node thank you for the followups.
I can confirm as @moddi3 mentioned, this didn't occur to me until recently, and I've been working on this specific project for 2+ months, hours and hours a day inside opencode.
@moddi3 whereas I can send follow ups, and it immediately continues where it left off.
I've actually had a couple of days without touching it, but I'll keep an eye out for any more occurrences on the latest versions.
grahamcropley commentedon Dec 5, 2025
Happened again, v1.0.133 - only using Github Copilot Claude Opus 4.5 - no delegation happening, just a single agent. Not using any other instances of Github Copilot anywhere.
And simply prompting it again, continues without missing a beat. (other that that 'token expired' one)