diegosouzapw/OmniRoute · error · CodexAuthFileError

refresh_failed

refresh_failed

Error message

Failed to refresh the Codex session before exporting the auth file. Re-authenticate this account if the session is stale.

What it means

Error "Failed to refresh the Codex session before exporting the auth file. Re-authenticate this account if the session is stale." thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/oauth/utils/codexAuthFile.ts:254

      idToken: connection.idToken,
      providerSpecificData: connection.providerSpecificData,
    },
    async (result) => {
      await updateProviderCredentials(connectionId, result);
      persistedRefresh = result;
    }
  );

  if (isUnrecoverableRefreshError(refreshed)) {
    throw new CodexAuthFileError(
      "Codex refresh token is no longer valid. Re-authenticate this account before exporting.",
      409,
      "reauth_required"
    );
  }

  if (!refreshed?.accessToken) {
    throw new CodexAuthFileError(
      "Failed to refresh the Codex session before exporting the auth file. Re-authenticate this account if the session is stale.",
      502,
      "refresh_failed"
    );
  }

  // If onPersist was not triggered (no accessToken path), fall back to explicit persist.
  if (!persistedRefresh) {
    await updateProviderCredentials(connectionId, refreshed);
  }

  const effectiveExpiresAt = refreshed.expiresAt
    ? refreshed.expiresAt
    : typeof refreshed.expiresIn === "number"
      ? new Date(Date.now() + refreshed.expiresIn * 1000).toISOString()
      : connection.expiresAt || null;

  return {

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/oauth/utils/codexAuthFile.ts:254 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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