Skip to content

1.0.98: Copilot Enterprise account routed to api.business.githubcopilot.com — 401 on model catalog, 'Authentication failed' despite valid token #5165

Open

Description

@hermes-realeye

Environment

  • Copilot CLI 1.0.98 (installed via official gh.io/copilot-install script, Linux x64, headless — no system keychain, token stored in plaintext ~/.copilot/config.json)
  • Auth via copilot login --device-code on github.com (not a GHEC data-residency tenant, GH_HOST unset)
  • Account shape: personal account whose GitHub Copilot access is provided by a GitHub Enterprise Cloud organization with a Copilot Enterprise seat (org Copilot management page shows "GitHub Copilot Enterprise", seat assigned and listed under "members with access to Copilot")

Symptom

Every copilot -p "<prompt>" invocation fails immediately:

Error: Authentication failed (Request ID: ...)

Your GitHub token may be invalid, expired, or lacking the required permissions.

CLI log (same run):

[ERROR] worker quit with fatal: Transport channel closed, when Client(OAuthChallenge { status_code: 401 ... })
[WARNING] MCP OAuth authorization failed; reporting the server as needing auth {"server":"github-mcp-server","error":"Browser-based OAuth required for https://api.business.githubcopilot.com/mcp/readonly"}
[ERROR] Error loading models: Error: 401 "Unauthorized"

The model-catalog fetch and the built-in github-mcp-server both target api.business.githubcopilot.com for this account.

The token is valid

The stored token returns 200 on GET https://api.github.com/user with the correct account, so "invalid/expired token" is not the cause.

Host matrix (same token, GET <host>/models)

Host Result
https://api.business.githubcopilot.com/models 401 Unauthorized (x-copilot-service-request-id: 717f9174-81b4-4f3d-a2bb-816f5b9e0d0b)
https://api.enterprise.githubcopilot.com/models 200 — full model catalog returned
https://api.githubcopilot.com/models 200 — full model catalog returned

So the account is authorized on the enterprise (and generic) Copilot API hosts, but the CLI routes this Copilot Enterprise-seat account to the business host, where it is rejected with 401. The CLI appears to classify the account as Copilot Business rather than Enterprise when resolving the Copilot API base (authGetCopilotApiUrl).

Impact

CLI is completely unusable for Copilot Enterprise accounts with a valid seat: the first authenticated call (model catalog) 401s, before any prompt can run. The error message is misleading — it suggests a token problem, but the token is fine; only the target host is wrong.

Reproduction

  1. Have a personal account whose Copilot is provided by a GitHub Enterprise Cloud org with a Copilot Enterprise seat.
  2. copilot login (device code flow).
  3. copilot -p "hi" → Error: Authentication failed.
  4. curl -H "Authorization: Bearer <stored token>" https://api.githubcopilot.com/models → 200, while the CLI's business host → 401.

Related

Activity

  1. hermes-realeye commented on Oct 16, 2026

    @hermes-realeye
    Author

    Follow-up with a concrete root-cause finding from this environment (repro account still available):

    The bad host is issued by the server, keyed by client version

    The Copilot CLI fetches per-account endpoint info at startup, and the response includes endpoints.api and endpoints.telemetry. The same account, same cache key gets different endpoints depending on which CLI version made the request:

    Client version copilot_plan / access_type_sku in response endpoints.api issued Result
    1.0.98 enterprise / copilot_enterprise_seat_quota https://api.business.githubcopilot.com 401 on /models and every model call
    1.0.99-2 (prerelease) enterprise / copilot_enterprise_seat_quota https://api.business.githubcopilot.com 401 (same)
    1.0.97 enterprise / copilot_enterprise_seat_quota https://api.enterprise.githubcopilot.com works (model calls succeed)

    The account is a Copilot Enterprise seat; its token is valid (GitHub API GET /user 200; same token returns 200 model catalogs on both api.enterprise.githubcopilot.com and api.githubcopilot.com). So the 1.0.98+ clients are being told by the endpoint-info response to use a host that rejects their own token, while 1.0.97 clients are told to use the host that accepts it. This points at the endpoint-assignment logic (version-gated rollout of the new host mapping?) rather than at the CLI's own routing code or at org policy.

    Secondary trap: the endpoint response is cached

    ~/.cache/copilot/copilot-user-cache.json (marked "Disposable cache … safe to delete. Managed automatically") caches that response. A client that was previously run at 1.0.98+ keeps using the cached business endpoint even after being replaced by the 1.0.97 launcher, until the cache is cleared — so a downgrade alone does not help; the cache must be removed (or expired) first.

    Workaround that works on the user's own license

    1. Run the 1.0.97 launcher (official release asset) with the 1.0.97 runtime in ~/.cache/copilot/pkg/linux-x64/.
    2. Delete ~/.cache/copilot/copilot-user-cache.json and exp-cache.json.
    3. Model calls then succeed against api.enterprise.githubcopilot.com.

    Note for maintainers: copilot --version prints the newest runtime present in the pkg directory, not the version actually executed — each launcher binary runs its own compiled version. This made version diagnosis confusing and may mislead users filing reports.

    Relevant issues: #4527, #4408. Happy to provide further details from this repro environment.

  2. added
    area:authenticationLogin, OAuth, device auth, token management, and keychain integration
    area:enterpriseGitHub Enterprise (GHE/GHES) support, org policies, and enterprise settings
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:authenticationLogin, OAuth, device auth, token management, and keychain integrationarea:enterpriseGitHub Enterprise (GHE/GHES) support, org policies, and enterprise settings

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions