VS Code Copilot Not Working? Here’s How to Fix It

VS Code Copilot Not Working? Here’s How to Fix It
GitHub Copilot is the AI-powered coding assistant that’s been transforming how developers write code inside Visual Studio Code. However, when it fails — especially with authentication errors like the dreaded 401 Copilot token error — productivity grinds to a halt. In this detailed guide, we break down exactly how to fix GitHub Copilot when it’s not working in VS Code, with tested solutions that work across platforms.
What Happens When Copilot Stops Working
You may notice Copilot isn’t suggesting code anymore, or you might see logs like:
[auth] Failed to get copilot token due to 401 status. Please sign out and try again.
This means Copilot can’t authenticate with GitHub, often due to expired tokens, account mismatches, or corrupted credentials.
Confirm Your Copilot Is Enabled and Licensed
- Visit: https://github.com/settings/copilot
- Ensure your GitHub account has an active Copilot subscription.
- Verify that you’re signed in with the same account in Visual Studio Code.
- If you’re using an organisation or enterprise account, confirm your admin has enabled Copilot access.
Clear Old Authentication Cache (Most Effective Fix)
This is the most reliable method to fix Copilot token issues, especially 401 errors
.
Follow these exact steps:
Click your account icon in the bottom-left corner of VS Code.
Click Sign Out for both GitHub and Copilot.
Open the Command Palette (
Ctrl + Shift + P
) and run:Developer: Open Settings (JSON)
Find and delete any lines that include:
github.token
copilot.token
For deeper cleanup:
Windows: Open Credential Manager → delete all entries containing GitHub or Copilot.
macOS/Linux: Open terminal and run:
git credential-reject
After cleanup, restart VS Code and sign in again. This method resets all corrupt or expired authentication sessions.
Sign Out and Sign In the Proper Way
If cache clearing didn’t help, try the full sign-in reset:
Run from Command Palette:
Copilot: Sign out
GitHub: Sign out
Restart VS Code.
Run:
GitHub: Sign in
Copilot: Sign in
Follow the browser prompts carefully and do not close the tab until confirmation appears.
Remove OAuth Access from GitHub Settings
Sometimes the issue is on GitHub’s end. You can revoke VS Code’s permission and reauthorise from scratch.
- Go to: https://github.com/settings/applications
- Under Authorized OAuth Apps, find Visual Studio Code.
- Click Revoke Access.
- Reopen VS Code and sign in again.
Update VS Code and Copilot Extension
Outdated extensions or software often cause bugs.
- Go to
Help > Check for Updates
in VS Code. - Open Extensions (
Ctrl+Shift+X
) - Search for GitHub Copilot, click Update if available.
- If issues persist, uninstall and reinstall the extension.
Disable VPN, Firewall, or Proxy
Authentication with GitHub requires uninterrupted access to:
https://github.com
https://vscode-auth.github.com
https://copilot-proxy.githubusercontent.com
Disable your VPN or proxy and retry authentication. Add these domains to your firewall allowlist if necessary.
Configure Git Credential Helper
If your credentials aren’t stored correctly, VS Code won’t be able to authenticate GitHub sessions.
Run this in terminal:
git config --global credential.helper manager-core
This command ensures GitHub credentials are stored and fetched properly on future requests.
Use Developer Tools to Trace Copilot Issues
Run:
Developer: Toggle Developer Tools
from Command PaletteGo to the Console tab.
Look for errors related to:
copilot
401
authentication
These logs often point directly to the root cause, such as permission issues, token expiry, or misconfigured scopes.
Set GitHub Enterprise Domain (If Applicable)
If you’re using GitHub Enterprise, you must set your enterprise domain manually.
- Run from Command Palette:
GitHub: Set GitHub Enterprise Domain
- Enter your organisation’s GitHub domain (e.g.,
https://github.company.com
) - Authenticate as usual after this setup.
Change Default Browser Temporarily
VS Code opens the sign-in window in your default system browser. Some browsers may block necessary redirects or cookies.
- Set your default browser to Chrome or Firefox.
- Retry the
GitHub: Sign in
andCopilot: Sign in
process.
Copilot Still Silent? Check Language Support and File Types
Ensure the file you’re working on is supported. Copilot works best in:
- JavaScript / TypeScript
- Python
- HTML / CSS
- Go, Java, C++, Ruby
Not all languages or file types are supported equally. Also check that suggestions haven’t been disabled in VS Code settings.
Copilot Icon Missing From Status Bar
If the Copilot icon vanishes:
- Open the Command Palette
- Run:
Copilot: Enable
- If no response, uninstall and reinstall the extension
Reload or Restart VS Code
Simple but effective:
- Run:
Developer: Reload Window
- Or fully close and reopen VS Code
This helps especially after cleaning tokens or changing authentication settings.
Final Troubleshooting Checklist
Action | Completed? |
---|---|
Cleared authentication cache | ✅ |
Signed out and in | ✅ |
Updated extensions and VS Code | ✅ |
Disabled VPN/proxy | ✅ |
Re-authorised on GitHub | ✅ |
Configured credential helper | ✅ |
Verified Copilot subscription | ✅ |
Conclusion
When GitHub Copilot stops working in VS Code, the cause is almost always related to authentication tokens, expired credentials, or misconfigurations. By following the full cleanup method, clearing all cached credentials, and signing in through the recommended steps, you can restore functionality and keep your workflow seamless.