microsoft / vscode-copilot-release

Feedback on GitHub Copilot Chat UX in Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=GitHub.copilot-chat
Creative Commons Attribution 4.0 International
295 stars 28 forks source link

Error: token expired or invalid: 401 #1175

Open virtuallyunknown opened 2 months ago

virtuallyunknown commented 2 months ago

Version: 1.88.1 Commit: e170252f762678dec6ca2cc69aba1570769a5d39 Date: 2024-04-10T17:34:12.840Z Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Linux x64 6.5.0-28-generic

image

2024-05-04 16:00:56.356 [info] [chat fetch] url https://api.githubcopilot.com/chat/completions
2024-05-04 16:00:56.356 [info] [chat fetch] modelMaxPromptTokens 3072
2024-05-04 16:00:56.356 [info] [chat fetch] modelMaxResponseTokens 2517
2024-05-04 16:00:56.356 [info] [chat fetch] chat model gpt-4
2024-05-04 16:00:56.363 [info] [auth] Logged in as virtuallyunknown
2024-05-04 16:00:56.363 [info] [chat] copilot token chat_enabled: true
2024-05-04 16:00:56.363 [info] [auth] Got Copilot token for virtuallyunknown
2024-05-04 16:00:56.483 [info] [chat fetch] request.response: [https://api.githubcopilot.com/chat/completions], took 119 ms
2024-05-04 16:00:56.483 [info] [chat fetch] Request ID for failed request: ,6471bc88-a50f-4faf-8325-c22354468d3f

I've seen many issues about the same error but with a different code 403, where I am getting code 401. The problem has been happening for a while, and I always assumed it will eventually get fixed with an update.

When this happens, I need to restart VSCode to get things working as normal again. This isn't that big of a deal with Copilot Chat since it will throw an error directly, but I don't always notice when the AI-assisted code completions/suggestions stop working.

I am not exactly sure what causes this, but I think it happens when I leave VSCode unattended for a while (30 minutes maybe?).

cglyqws commented 2 months ago

I have met the same problem...

virtuallyunknown commented 2 months ago

I couldn't manage to include diagnostics in my original post because VSCode crashed (for unrelated reasons), but today I got the same issue so here is the output when Copilot and VSCode are in 401 state, so to speak:

Copilot

Environment

Feature Flags

Node setup

Network Configuration

Reachability

VS Code Configuration

Extensions

Authentication

anuvrat-rastogi commented 1 month ago

bumped into the same issue

dezguell commented 1 month ago

Same issue here. Some times the chat section looks empty and other times the chat throws 401 error. The section gets unresponsive. image This feature is not working image Looks like the autocompletion is working fine image This is happening despite authentication was successful image

luismatias90 commented 1 month ago

I was having this problem, and for me, I just enabled the "Copilot Chat in the IDE" option in the GitHub Copilot policies settings. It worked :)

image

dezguell commented 1 month ago

I was having this problem, and for me, I just enabled the "Copilot Chat in the IDE" option in the GitHub Copilot policies settings. It worked :)

image

Oh, that was the problem! Thanks a lot for the suggestion!

virtuallyunknown commented 1 month ago

I was having this problem, and for me, I just enabled the "Copilot Chat in the IDE" option in the GitHub Copilot policies settings. It worked :)

image

Do I need to have an organization in my github account to enable this setting? I am not exactly sure where this setting is enabled from.

I am using Copilot Individual, not business or enterprise, so I'm not sure this fix is applicable to me.

dezguell commented 1 month ago

I was having this problem, and for me, I just enabled the "Copilot Chat in the IDE" option in the GitHub Copilot policies settings. It worked :) image

Do I need to have an organization in my github account to enable this setting? I am not exactly sure where this setting is enabled from.

I am using Copilot Individual, not business or enterprise, so I'm not sure this fix is applicable to me.

You need to go to: Organization Settings -> Copilot->polices!

virtuallyunknown commented 1 month ago

Appreciate your help @dezguell, but I am not a member of any organizations.

https://github.com/settings/organizations

On this page all I have is this, so I don't have the option to change any organization settings:

image

virtuallyunknown commented 1 week ago

@TylerLeonhardt this is still happening, and it's still very annoying having to restart VSCode every time. Any chance someone can look into it?

I'm only tagging you because it says you were assigned for this issue, but we haven't heard any official response so far. Thanks.

TylerLeonhardt commented 1 week ago

Hi @virtuallyunknown sorry for the delay here. I have done some work recently to improve the experience. I'm curious if it fixes the issue you're seeing.

You can try out the changes in the Insiders build of VS Code and then get the GitHub Copilot Chat pre-release version. Just go to the Extension Pane and it should allow you to install the pre-release.

Can you grab those and let me know if that helps?

virtuallyunknown commented 1 week ago

Hi @virtuallyunknown sorry for the delay here. I have done some work recently to improve the experience. I'm curious if it fixes the issue you're seeing.

You can try out the changes in the Insiders build of VS Code and then get the GitHub Copilot Chat pre-release version. Just go to the Extension Pane and it should allow you to install the pre-release.

Can you grab those and let me know if that helps?

Thanks for the response!

I have switched to the pre-release version of the extension and I will let you know if the issue occurs again.

As for the insiders build of VSCode itself, these updates are going to make it into the stable release next month, is that correct? I prefer to just wait until then to test, as switching from normal to insiders probably requires some setup and time investment, and I depend on my code editor for work.

Anyway, when I have some useful information I will let you know!