{"record":{"id":"1ddb51c61d540637","repo":"can1357/oh-my-pi","slug":"no-codex-oauth-credentials-found-login-with-omp","errorCode":null,"errorMessage":"No Codex OAuth credentials found. Login with 'omp /login openai-codex' to enable Codex web search.","messagePattern":"No Codex OAuth credentials found\\. Login with 'omp /login openai-codex' to enable Codex web search\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/web/search/providers/codex.ts","lineNumber":796,"sourceCode":"\t\t\tkeyOrResolver,\n\t\t\taccessToken =>\n\t\t\t\trunCodexSearchCandidates({\n\t\t\t\t\tauth: { accessToken },\n\t\t\t\t\tparams,\n\t\t\t\t\tquery,\n\t\t\t\t\tmodelCandidates,\n\t\t\t\t\tmodelWasConfigured: configuredModel !== undefined,\n\t\t\t\t\ttransport,\n\t\t\t\t}),\n\t\t\t{\n\t\t\t\tsignal: params.signal,\n\t\t\t\tmissingKeyMessage: 'Codex credentials not found. Configure an API key for provider \"openai-codex\".',\n\t\t\t},\n\t\t);\n\t} else {\n\t\tconst seed = await findCodexAuth(params.authStorage, params.sessionId, params.signal);\n\t\tif (!seed) {\n\t\t\tthrow new Error(\n\t\t\t\t\"No Codex OAuth credentials found. Login with 'omp /login openai-codex' to enable Codex web search.\",\n\t\t\t);\n\t\t}\n\n\t\tresult = await withOAuthAccess(\n\t\t\tparams.authStorage,\n\t\t\t\"openai-codex\",\n\t\t\taccess => {\n\t\t\t\t// A refreshed/rotated credential can carry a different bearer and\n\t\t\t\t// ChatGPT account id than the seed used to select the first attempt.\n\t\t\t\tconst accountId = access.accountId ?? getCodexAccountId(access.accessToken);\n\t\t\t\tif (!accountId) {\n\t\t\t\t\tthrow new Error(\"Codex OAuth credential is missing a ChatGPT account id\");\n\t\t\t\t}\n\t\t\t\treturn runCodexSearchCandidates({\n\t\t\t\t\tauth: { accessToken: access.accessToken, accountId },\n\t\t\t\t\tparams,\n\t\t\t\t\tquery,","sourceCodeStart":778,"sourceCodeEnd":814,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/web/search/providers/codex.ts#L778-L814","documentation":"On the default (official endpoint) path, searchCodex calls findCodexAuth to locate Codex OAuth credentials in AuthStorage. If no seed credential exists, it throws a plain Error instructing the user to run `omp /login openai-codex`. The provider requires ChatGPT OAuth to authenticate Codex web search and cannot proceed anonymously.","triggerScenarios":"No custom endpoint is configured, findCodexAuth(params.authStorage, sessionId, signal) returns null — i.e. no openai-codex OAuth entry in auth storage for this session — and searchCodex is invoked (e.g. via the provider chain).","commonSituations":"Fresh install or CI container without prior login; auth storage cleared or on a different HOME; expired credentials removed by refresh logic; running Codex search before ever running the login command.","solutions":["Run `omp /login openai-codex` to store ChatGPT OAuth credentials.","Check that auth storage exists and is readable (correct HOME / OMP config dir) in the environment running the search.","Configure an API key / custom endpoint path instead if OAuth login is not possible (note the custom-endpoint OAuth refusal).","Use a different search provider that supports API keys (Brave, Tavily, Exa, Kagi)."],"exampleFix":"// before\n// CI runs codex search with no credentials\nError: No Codex OAuth credentials found...\n// after\n# one-time setup in the environment\n$ omp /login openai-codex\n$ omp web-search --provider codex \"query\"","handlingStrategy":"validation","validationCode":"const seed = await findCodexAuth(authStorage, sessionId);\nif (!seed) {\n  throw new Error(\"Run 'omp /login openai-codex' before using Codex web search\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await searchCodex(params);\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"omp /login openai-codex\")) {\n    return searchWithApiKeyProvider(params); // e.g. tavily/brave\n  }\n  throw e;\n}","preventionTips":["Run `omp /login openai-codex` during environment provisioning.","Verify auth storage presence in CI images before enabling the codex provider.","Keep API-key providers configured as fallback for non-logged-in environments."],"tags":["authentication","oauth","codex","credentials","search-provider"],"backgroundTag":"missing-oauth-credentials","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}