{"record":{"id":"5e8ca23adf504f2d","repo":"HKUDS/DeepTutor","slug":"openai-codex-is-not-logged-in-run-deeptutor-prov","errorCode":null,"errorMessage":"OpenAI Codex is not logged in. Run `deeptutor provider login openai-codex`.","messagePattern":"OpenAI Codex is not logged in\\. Run `deeptutor provider login openai-codex`\\.","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/llm/provider_core/openai_codex_provider.py","lineNumber":193,"sourceCode":"            model,\n            reasoning_effort,\n            tool_choice,\n            on_content_delta,\n        )\n\n    def get_default_model(self) -> str:\n        return self.default_model\n\n\ndef _strip_model_prefix(model: str) -> str:\n    if model.startswith(\"openai-codex/\") or model.startswith(\"openai_codex/\"):\n        return model.split(\"/\", 1)[1]\n    return model\n\n\ndef _build_headers(account_id: str, token: str) -> dict[str, str]:\n    if not token:\n        raise RuntimeError(\n            \"OpenAI Codex is not logged in. Run `deeptutor provider login openai-codex`.\"\n        )\n    headers = {\n        \"Authorization\": f\"Bearer {token}\",\n        \"OpenAI-Beta\": \"responses=experimental\",\n        \"originator\": DEFAULT_ORIGINATOR,\n        \"User-Agent\": \"DeepTutor (python)\",\n        \"accept\": \"text/event-stream\",\n        \"content-type\": \"application/json\",\n    }\n    if account_id:\n        headers[\"chatgpt-account-id\"] = str(account_id)\n    return headers\n\n\nasync def _request_codex(\n    url: str,\n    headers: dict[str, str],","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/llm/provider_core/openai_codex_provider.py#L175-L211","documentation":"_build_headers refuses to construct Authorization headers with an empty token, raising RuntimeError with the exact remediation command. The Codex session store yielded no access token.","triggerScenarios":"_call_codex → _build_headers(account_id, token='') because the stored Codex auth session has no access token — user never logged in, or the credential store is empty/corrupt.","commonSituations":"Fresh machine or container without Codex credentials; credentials file deleted; running in CI without a pre-provisioned auth session.","solutions":["Run `deeptutor provider login openai-codex`.","Verify the credential store was provisioned (volume-mounted in containers).","Re-login after clearing a corrupted store."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def codex_logged_in(token: str) -> bool:\n    return bool(token)","typeGuard":null,"tryCatchPattern":"try:\n    resp = await provider.chat(messages)\nexcept RuntimeError as e:\n    if 'not logged in' in str(e):\n        run_cli('deeptutor provider login openai-codex')\n    raise","preventionTips":["Provision Codex credentials in CI via a mounted store before jobs","Check credential existence in deployment checklists","Automate re-login after credential store resets"],"tags":["auth","codex","login-required"],"backgroundTag":"oauth-token-missing","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}