coleam00/Archon · error · GithubIdentityConflictError

GitHub account @${login} is already linked to a different Ar

Error message

GitHub account @${login} is already linked to a different Archon user.

What it means

Error "GitHub account @${login} is already linked to a different Archon user." thrown in coleam00/Archon.

Source

Thrown at packages/core/src/db/users.ts:260

           updated_at = ${dialect.now()}
     WHERE id = $3`,
    [profile.display_name ?? null, profile.email ?? null, userId]
  );
}

/**
 * Attach a GitHub identity to an EXISTING Archon user (the connecting actor).
 * Unlike findOrCreateUserByPlatformIdentity, this never mints a new user — the
 * device-flow connect surfaces already have the actor's user_id and only need
 * to bind their GitHub login to it. Throws GithubIdentityConflictError if the
 * login already maps to a different user.
 */
export async function linkGithubIdentity(userId: string, login: string): Promise<void> {
  const platform: IdentityPlatform = 'github';
  const existing = await selectIdentity(platform, login);
  if (existing) {
    if (existing.user_id !== userId) {
      throw new GithubIdentityConflictError(login);
    }
    await pool.query(
      'UPDATE remote_agent_user_identities SET platform_display_name = $1 WHERE id = $2',
      [login, existing.id]
    );
    getLog().info({ userId, login }, 'user.github_identity_relinked');
    return;
  }
  try {
    await pool.query(
      `INSERT INTO remote_agent_user_identities (user_id, platform, platform_user_id, platform_display_name)
       VALUES ($1, $2, $3, $4)`,
      [userId, platform, login, login]
    );
    getLog().info({ userId, login }, 'user.github_identity_linked');
  } catch (err) {
    // Concurrent connect of the same ('github', login) raced us past the SELECT
    // and inserted first. UNIQUE(platform, platform_user_id) rejects the loser —

View on GitHub (pinned to 0773b97458)

When it happens

Trigger: Thrown at packages/core/src/db/users.ts:260 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/e3ffc030280f1f52. Report an issue: GitHub.