tinyhumansai/openhuman · error

OPENAI_CODEX_OAUTH_MISSING_AUTH_URL

OPENAI_CODEX_OAUTH_MISSING_AUTH_URL

Error message

OPENAI_CODEX_OAUTH_MISSING_AUTH_URL

What it means

startOpenAiCodexOAuth called the core RPC openhuman.inference_openai_oauth_start successfully, but the result carried no non-empty result.authUrl (after trim). Without an authorization URL there is nothing to open in a browser, so the OAuth flow cannot start; the constant OPENAI_CODEX_OAUTH_MISSING_AUTH_URL marks this specific failure.

Source

Thrown at app/src/services/api/aiSettingsApi.ts:726

/** Clear a stored API key. */
export async function clearCloudProviderKey(slug: string): Promise<void> {
  if (slug === 'openhuman') {
    return;
  }
  // Clear the new-style key. Legacy bare-slug entries are left as-is
  // since we can't be sure they aren't used by other things.
  await authRemoveProviderCredentials({ provider: authKeyForSlug(slug), profile: 'default' });
}

export async function startOpenAiCodexOAuth(): Promise<OpenAiCodexOAuthStartResult> {
  const res = await callCoreRpc<{ result: OpenAiCodexOAuthStartResult }>({
    method: 'openhuman.inference_openai_oauth_start',
    params: {},
  });
  const authUrl = res?.result?.authUrl?.trim();
  if (!authUrl) {
    throw new Error(OPENAI_CODEX_OAUTH_MISSING_AUTH_URL);
  }
  return res.result;
}

export async function completeOpenAiCodexOAuth(callbackUrl: string): Promise<void> {
  const callback = callbackUrl.trim();
  if (!callback) {
    throw new Error(OPENAI_CODEX_OAUTH_MISSING_CALLBACK_URL);
  }
  await callCoreRpc({
    method: 'openhuman.inference_openai_oauth_complete',
    params: { callback_url: callback },
  });
}

export async function importOpenAiCodexCliAuth(): Promise<void> {
  await callCoreRpc({ method: 'openhuman.inference_openai_oauth_import_codex_cli', params: {} });
}

View on GitHub (pinned to a221052e0d)

Solutions

  1. Update/restart the desktop core so inference_openai_oauth_start runs the current implementation
  2. Check the core-side OpenAI OAuth configuration (client id/secret env or config) and complete it
  3. Inspect the core logs for the oauth start handler to see why authUrl was omitted
  4. Wrap the call and surface a clear 'could not start OpenAI sign-in' message with a retry

Example fix

// before
const { authUrl } = await startOpenAiCodexOAuth();
window.open(authUrl, '_blank');

// after
let authUrl: string;
try {
  ({ authUrl } = await startOpenAiCodexOAuth());
} catch (e) {
  showOAuthError('Could not start OpenAI sign-in. Update the app and try again.');
  return;
}
window.open(authUrl, '_blank');
Defensive patterns

Strategy: try-catch

Type guard

const hasAuthUrl = (r: unknown): r is { authUrl: string } =>
  typeof (r as { authUrl?: unknown })?.authUrl === 'string' && (r as { authUrl: string }).authUrl.trim().length > 0;

Try / catch

try { const { authUrl } = await startOpenAiCodexOAuth(); openInBrowser(authUrl); }
catch (e) { showOAuthError('Could not start OpenAI sign-in — update/restart the app and retry.'); logError(e); }

Prevention

When it happens

Trigger: Invoking 'Sign in with ChatGPT/Codex' and the core's OpenAI OAuth start handler returns { result: {} } or { result: { authUrl: ' ' } } — e.g. missing/misconfigured OAuth client credentials on the core side, or a core build where the OpenAI OAuth feature is degraded.

Common situations: Dev environment without the required OpenAI OAuth client id/secret configured in the core; version skew between an older core and a newer frontend expecting authUrl; enterprise proxy stripping the field. The RPC 'succeeds', so the failure only appears at this shape check.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/6b6f7d3cc602eae0. Report an issue: GitHub.