Repository navigation
GitHub Copilot provider fails silently on Linux (v1.18.13) — OAuth token missing copilot scope, no models registered #40828
Description
Description
Description
On Linux (Kali, ARM64, via npm install -g opencode-ai), the GitHub Copilot login flow (/connect → github) completes without any visible error, but the resulting OAuth token is never exchanged for a valid Copilot session token. As a result, opencode models lists zero github-copilot/* models, and forcing a model explicitly with -m github-copilot/ fails with a generic UnknownError.
The exact same GitHub account works correctly with OpenCode v1.14.33 on macOS — same account, same Copilot Student entitlement, fully functional. Downgrading to v1.14.33 on the same Linux machine fixes the issue completely, strongly suggesting a regression introduced between 1.14.33 and 1.18.13 specifically affecting the github-copilot provider's OAuth flow.
Environment
Broken: OpenCode v1.18.13, Kali Linux (ARM64, UTM/QEMU VM), installed via npm install -g opencode-ai
Working: OpenCode v1.14.33, macOS
Same GitHub account (Copilot Individual, Student educational quota) in both cases
Steps to reproduce (on v1.18.13 / Linux)
opencode → /connect → select GitHub → complete device flow in browser
Login appears to succeed (no error shown)
opencode models → no github-copilot/* entries appear in the list
opencode run -m github-copilot/claude-sonnet-4.5 "hi" → fails
Root cause (confirmed via manual diagnosis)
Inspecting ~/.local/share/opencode/auth.json after login:
json
"github-copilot": {
"type": "oauth",
"access": "gho_...",
"refresh": "gho_...", // identical to access
"expires": 0
}
access and refresh are identical — the raw GitHub OAuth token from the device flow, never exchanged for a real Copilot session token.
expires: 0 — no real expiry was ever set, confirming the exchange step never completed.
Checking the token's scope directly:
curl -sI -H "Authorization: token gho_..." https://api.github.com/user | grep -i scope
→ x-oauth-scopes: read:user
The device flow only requests read:user. It appears to never request whatever scope/authorization is needed for GitHub to allow the client_id used by OpenCode to call the Copilot token-exchange endpoint.
Confirmed the token itself is otherwise valid (/user returns correct account info, Copilot entitlement confirmed via /copilot_internal/user with a separately-generated fine-grained PAT — chat_enabled: true, cli_enabled: true, plan individual).
Calling the actual exchange endpoint manually with this token always returns 404:
curl -s -H "Authorization: token gho_..." https://api.github.com/copilot_internal/v2/token
→ {"message":"Not Found","documentation_url":"https://docs.github.com/rest","status":"404"}
This reproduced identically across two separate fresh logins (including after fully revoking the OAuth grant from GitHub's side and reconnecting from scratch) — not a one-off token issue.
For comparison, the official GitHub copilot CLI (installed via gh copilot) authenticates successfully and works out of the box on the same machine, same account — so this is not an account/entitlement/network problem, it's specific to how OpenCode's github-copilot provider performs its OAuth handshake in this version.
Fix / workaround
Downgrading resolves it completely:
bash
npm install -g opencode-ai@1.14.33
After re-running /connect, opencode models correctly lists the full github-copilot/* catalog (Claude Sonnet/Opus, GPT-5.x, Gemini, etc.) and inference works.
Expected behavior
The device-flow OAuth login for the github-copilot provider should request whatever scope/authorization GitHub requires, complete the token exchange automatically after login, and populate opencode models with the available Copilot models — as it does correctly in v1.14.33.
Plugins
No response
OpenCode version
1.18.13
Steps to reproduce
No response
Screenshot and/or share link
No response
Operating System
No response
Terminal
No response
Activity
github-actions commentedon Aug 6, 2026
This issue might be a duplicate of existing issues. Please check:
expires: 0, identicalaccessandrefreshtokens after Copilot device-flow login, Copilot Student plan on Linuxexpires: 0(closed)Please review those issues to see if your problem is already tracked, and consider adding your findings there if they match.
OpeOginni commentedon Aug 6, 2026
what subscription of copilot are you on?
github-actions commentedon Oct 7, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.