{"record":{"id":"5f763962e577bbce","repo":"coleam00/Archon","slug":"copilot-authentication-failed-combined-run-c","errorCode":null,"errorMessage":"Copilot authentication failed: ${combined}\n\nRun `copilot login` (default), set COPILOT_GITHUB_TOKEN, or set `useLoggedInUser: false` in `.archon/config.yaml` to use GH_TOKEN / GITHUB_TOKEN.","messagePattern":"Copilot authentication failed: (.+?)\n\nRun `copilot login` \\(default\\), set COPILOT_GITHUB_TOKEN, or set `useLoggedInUser: false` in `\\.archon/config\\.yaml` to use GH_TOKEN / GITHUB_TOKEN\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/providers/src/community/copilot/provider.ts","lineNumber":620,"sourceCode":"        skills: sessionConfig.skillDirectories?.length ?? 0,\n        agents: sessionConfig.customAgents?.length ?? 0,\n        tokenSource,\n        resumed: resumeSessionId !== undefined && !resumeFailed,\n      },\n      'copilot.session_started'\n    );\n\n    try {\n      yield* bridgeSession(\n        session,\n        effectivePrompt,\n        requestOptions?.abortSignal,\n        wantsStructured ? outputFormat.schema : undefined\n      );\n      log.info({ sessionId: session.sessionId }, 'copilot.prompt_completed');\n    } catch (err) {\n      log.error({ err, sessionId: session.sessionId }, 'copilot.prompt_failed');\n      throw buildFriendlyCopilotError(err);\n    } finally {\n      // Stop the client so its CLI subprocess shuts down; bridgeSession already\n      // handled session.abort() + session.disconnect() in its own finally.\n      try {\n        const stopErrors = await client.stop();\n        if (stopErrors.length > 0) {\n          log.warn({ errors: stopErrors.map(e => e.message) }, 'copilot.client_stop_errors');\n        }\n      } catch (stopErr) {\n        log.debug({ err: stopErr }, 'copilot.client_stop_threw');\n      }\n    }\n  }\n}\n","sourceCodeStart":602,"sourceCodeEnd":635,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/providers/src/community/copilot/provider.ts#L602-L635","documentation":"Same buildFriendlyCopilotError classification path, but for authentication failures: the Copilot CLI/SDK sign-in was missing or rejected. The message aggregates the thrown error with the SDK's session.error detail and lists the three supported auth routes: interactive `copilot login`, COPILOT_GITHUB_TOKEN, or useLoggedInUser:false with GH_TOKEN/GITHUB_TOKEN in .archon/config.yaml.","triggerScenarios":"Running a Copilot provider node with no prior `copilot login`, an expired GitHub token, a token lacking Copilot entitlement, GITHUB_TOKEN set to an invalid PAT while useLoggedInUser is false, or CI where no interactive login exists and no token env var is exported.","commonSituations":"First run in CI without COPILOT_GITHUB_TOKEN; token expired or rotated; `copilot login` done under a different user than the token env vars imply; GitHub SSO/organization requires re-authorization; GITHUB_TOKEN is a fine-grained PAT without Copilot access.","solutions":["Run `copilot login` interactively on the machine running Archon.","Export COPILOT_GITHUB_TOKEN with a token that has Copilot access.","Alternatively set useLoggedInUser: false in .archon/config.yaml and provide GH_TOKEN/GITHUB_TOKEN (e.g. a CI token with Copilot entitlement).","If a token is present but rejected, read the `combined` detail for expiry/scope messages and regenerate the token."],"exampleFix":"# CI environment\nexport COPILOT_GITHUB_TOKEN=ghp_xxx\n# or .archon/config.yaml\nassistants:\n  copilot:\n    useLoggedInUser: false","handlingStrategy":"validation","validationCode":"// before running Copilot nodes\nconst hasInteractiveLogin = await exists('~/.config/github-copilot');\nconst hasToken = Boolean(process.env.COPILOT_GITHUB_TOKEN ?? process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN);\nif (!hasInteractiveLogin && !hasToken) {\n  throw new Error('No Copilot credentials: run `copilot login` or export COPILOT_GITHUB_TOKEN');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runCopilotNode(node);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('Copilot authentication failed:')) {\n    throw new Error('Re-authenticate: `copilot login`, or set COPILOT_GITHUB_TOKEN (CI)');\n  }\n  throw err;\n}","preventionTips":["In CI, always export COPILOT_GITHUB_TOKEN (or GH_TOKEN with useLoggedInUser:false) as a secret.","Rotate Copilot tokens before expiry and verify Copilot entitlement on new tokens.","After `copilot login`, confirm the logged-in user matches the intended account.","Run a one-prompt smoke test after any credential rotation."],"tags":["copilot","github","authentication","configuration"],"backgroundTag":"provider-auth-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}