diegosouzapw/OmniRoute · error

Device auth initiation failed

Error message

Device auth initiation failed: ${error}

What it means

Generic catch-all for a non-ok (non-429) response from Kilocode's device-auth initiation endpoint; the raw response text is appended. Indicates the initiation request itself failed upstream — auth service errors, invalid client configuration, or upstream outages. The body text is un-sanitized upstream output.

Solutions

  1. Read the appended response body to identify the upstream failure reason
  2. Verify the Kilocode initiateUrl and request configuration are correct
  3. If upstream reports 5xx, retry after a short backoff
  4. Route the message through error sanitization before surfacing it in an HTTP/API response
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/lib/oauth/providers/kilocode.ts:19 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/9f52c02150b9965d. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/oauth/providers/kilocode.ts:19

import { KILOCODE_CONFIG } from "../constants/oauth";

export const kilocode = {
  config: KILOCODE_CONFIG,
  flowType: "device_code",
  requestDeviceCode: async (config) => {
    const response = await fetch(config.initiateUrl, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
    });

    if (!response.ok) {
      if (response.status === 429) {
        throw new Error("Too many pending authorization requests. Please try again later.");
      }
      const error = await response.text();
      throw new Error(`Device auth initiation failed: ${error}`);
    }

    const data = await response.json();
    return {
      device_code: data.code,
      user_code: data.code,
      verification_uri: data.verificationUrl,
      verification_uri_complete: data.verificationUrl,
      expires_in: data.expiresIn || 300,
      interval: 3,
    };
  },
  pollToken: async (config, deviceCode) => {
    const response = await fetch(`${config.pollUrlBase}/${deviceCode}`);

    if (response.status === 202) {
      return { ok: false, data: { error: "authorization_pending" } };
    }

View on GitHub (pinned to a179ffed5b)