diegosouzapw/OmniRoute · error · CodexResetCreditError

codex_access_token_missing

codex_access_token_missing

Error message

Codex OAuth access token is missing.

What it means

Error "Codex OAuth access token is missing." thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/usage/codexResetCredits.ts:284

  if (!text) return {};
  try {
    return JSON.parse(text);
  } catch {
    return text;
  }
}

function getWorkspaceId(connection: CodexConnectionLike): string | null {
  const providerSpecificData = toRecord(connection.providerSpecificData);
  const workspaceId = providerSpecificData.workspaceId;
  return typeof workspaceId === "string" && workspaceId.trim().length > 0
    ? workspaceId.trim()
    : null;
}

function buildCodexResetCreditHeaders(connection: CodexConnectionLike): Record<string, string> {
  if (!connection.accessToken) {
    throw new CodexResetCreditError(
      401,
      "codex_access_token_missing",
      "Codex OAuth access token is missing."
    );
  }

  const headers: Record<string, string> = {
    Authorization: `Bearer ${connection.accessToken}`,
    "Content-Type": "application/json",
    Accept: "application/json",
    // Canonical Codex backend identity (UA + originator + version), same
    // chain as inference — see getCodexUsage.
    ...getCodexBackendIdentityHeaders(),
  };

  const workspaceId = getWorkspaceId(connection);
  if (workspaceId) headers["chatgpt-account-id"] = workspaceId;

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/usage/codexResetCredits.ts:284 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/599a0f167e86def5. Report an issue: GitHub.