HKUDS/DeepTutor · error · RuntimeError

OpenAI Codex is not logged in. Run `deeptutor provider login

Error message

OpenAI Codex is not logged in. Run `deeptutor provider login openai-codex`.

What it means

_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.

Source

Thrown at deeptutor/services/llm/provider_core/openai_codex_provider.py:193

            model,
            reasoning_effort,
            tool_choice,
            on_content_delta,
        )

    def get_default_model(self) -> str:
        return self.default_model


def _strip_model_prefix(model: str) -> str:
    if model.startswith("openai-codex/") or model.startswith("openai_codex/"):
        return model.split("/", 1)[1]
    return model


def _build_headers(account_id: str, token: str) -> dict[str, str]:
    if not token:
        raise RuntimeError(
            "OpenAI Codex is not logged in. Run `deeptutor provider login openai-codex`."
        )
    headers = {
        "Authorization": f"Bearer {token}",
        "OpenAI-Beta": "responses=experimental",
        "originator": DEFAULT_ORIGINATOR,
        "User-Agent": "DeepTutor (python)",
        "accept": "text/event-stream",
        "content-type": "application/json",
    }
    if account_id:
        headers["chatgpt-account-id"] = str(account_id)
    return headers


async def _request_codex(
    url: str,
    headers: dict[str, str],

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Run `deeptutor provider login openai-codex`.
  2. Verify the credential store was provisioned (volume-mounted in containers).
  3. Re-login after clearing a corrupted store.
Defensive patterns

Strategy: validation

Validate before calling

def codex_logged_in(token: str) -> bool:
    return bool(token)

Try / catch

try:
    resp = await provider.chat(messages)
except RuntimeError as e:
    if 'not logged in' in str(e):
        run_cli('deeptutor provider login openai-codex')
    raise

Prevention

When it happens

Trigger: _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.

Common situations: Fresh machine or container without Codex credentials; credentials file deleted; running in CI without a pre-provisioned auth session.

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/5e8ca23adf504f2d. Report an issue: GitHub.