diegosouzapw/OmniRoute · error · Error

Failed to create Command Code auth session

Error message

Failed to create Command Code auth session

What it means

Error "Failed to create Command Code auth session" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/db/commandCodeAuth.ts:127

export function createPendingCommandCodeAuthSession(input: {
  stateHash: string;
  expiresAt: string;
}): CommandCodeAuthSafeStatus {
  const id = randomUUID();
  const now = nowIso();
  db()
    .prepare(
      `INSERT INTO command_code_auth_sessions (
        id, state_hash, status, encrypted_api_key, metadata_json,
        created_at, expires_at, received_at, applied_at, updated_at
      ) VALUES (?, ?, 'pending', NULL, NULL, ?, ?, NULL, NULL, ?)`
    )
    .run(id, input.stateHash, now, input.expiresAt, now);

  const row = db()
    .prepare<AuthSessionRow>("SELECT * FROM command_code_auth_sessions WHERE id = ?")
    .get(id);
  if (!row) throw new Error("Failed to create Command Code auth session");
  return toSafeStatus(row);
}

export function markCommandCodeAuthSessionReceived(input: {
  stateHash: string;
  apiKey: string;
  metadata?: CommandCodeAuthMetadata;
}): CommandCodeAuthSafeStatus | null {
  const now = nowIso();
  markExpiredForState(input.stateHash, now);
  const metadata: CommandCodeAuthMetadata = {
    ...(input.metadata || {}),
    receivedAt: now,
  };
  const encryptedApiKey = encrypt(input.apiKey);
  db()
    .prepare(
      `UPDATE command_code_auth_sessions

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/db/commandCodeAuth.ts:127 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/e574101fda6880f4. Report an issue: GitHub.