coleam00/Archon · error · DeviceFlowError

http_error

http_error

Error message

GitHub device flow returned HTTP ${res.status}${detail ? `: ${detail}` : ''}

What it means

Error "GitHub device flow returned HTTP ${res.status}${detail ? `: ${detail}` : ''}" thrown in coleam00/Archon.

Source

Thrown at packages/core/src/github-auth/device-flow.ts:77

async function postForm<T>(url: string, params: Record<string, string>): Promise<T> {
  const res = await fetch(url, {
    method: 'POST',
    headers: { Accept: 'application/json', 'Content-Type': 'application/x-www-form-urlencoded' },
    body: new URLSearchParams(params).toString(),
  });
  if (!res.ok) {
    // GitHub returns actionable detail in the body even on non-2xx (e.g.
    // {"error":"invalid_client","error_description":"..."}). Surface it so a
    // misconfigured client id reads as more than a bare "HTTP 401".
    let detail = '';
    try {
      const body = (await res.json()) as { error_description?: string; error?: string };
      detail = body.error_description ?? body.error ?? '';
    } catch {
      // Body was not JSON — fall back to the status line only.
    }
    throw new DeviceFlowError(
      'http_error',
      `GitHub device flow returned HTTP ${res.status}${detail ? `: ${detail}` : ''}`
    );
  }
  return (await res.json()) as T;
}

/** Step 1: request device + user codes. */
export async function startDeviceFlow(clientId: string): Promise<DeviceCodeResponse> {
  const data = await postForm<DeviceCodeResponse & { error?: string }>(DEVICE_CODE_URL, {
    client_id: clientId,
  });
  if (data.error) throw new DeviceFlowError(data.error);
  return data;
}

export interface PollOptions {
  signal?: AbortSignal;

View on GitHub (pinned to 0773b97458)

When it happens

Trigger: Thrown at packages/core/src/github-auth/device-flow.ts:77 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/5cac0bf28b9a9edc. Report an issue: GitHub.