HKUDS/Vibe-Trading · error · RuntimeError
OpenAI Codex OAuth requires oauth-cli-kit. Install dependenc
Error message
OpenAI Codex OAuth requires oauth-cli-kit. Install dependencies, then run: {_CODEX_LOGIN_COMMAND} What it means
_load_codex_oauth_provider imports OPENAI_CODEX_PROVIDER from oauth_cli_kit; failure means the OAuth provider constants for ChatGPT/Codex login are unavailable, and login or token refresh cannot proceed.
Source
Thrown at agent/src/providers/openai_codex.py:204
"""Return the access token's real JWT expiry, with stored expiry fallback."""
access = getattr(token, "access", "")
claims = _decode_jwt_claims(access) if isinstance(access, str) else {}
jwt_expiry = claims.get("exp")
if isinstance(jwt_expiry, (int, float)) and not isinstance(jwt_expiry, bool):
return int(jwt_expiry * 1000)
try:
stored_expiry = int(getattr(token, "expires"))
except (TypeError, ValueError):
return 0
return stored_expiry * 1000 if stored_expiry < 100_000_000_000 else stored_expiry
def _load_codex_oauth_provider() -> Any:
"""Load oauth-cli-kit's provider constants without using its token cache."""
try:
from oauth_cli_kit import OPENAI_CODEX_PROVIDER
except ImportError as exc:
raise RuntimeError(
f"OpenAI Codex OAuth requires oauth-cli-kit. Install dependencies, then run: {_CODEX_LOGIN_COMMAND}"
) from exc
return OPENAI_CODEX_PROVIDER
@dataclass
class CodexToolCall:
"""Internal tool-call representation compatible with ChatLLM parsing."""
id: str
name: str
arguments: dict[str, Any]
def as_langchain_tool_call(self) -> dict[str, Any]:
return {"id": self.id, "name": self.name, "args": self.arguments}
@dataclassView on GitHub (pinned to 80ffdda44c)
Solutions
- Install oauth-cli-kit, then re-run the login command shown in the message (_CODEX_LOGIN_COMMAND)
- Verify: python -c "from oauth_cli_kit import OPENAI_CODEX_PROVIDER"
- Ensure you installed into the same interpreter the agent runs under (pip -m or match the venv)
Example fix
# before RuntimeError: OpenAI Codex OAuth requires oauth-cli-kit... # after pip install oauth-cli-kit vibe-trading provider login openai-codex # re-run login
Defensive patterns
Strategy: try-catch
Validate before calling
try:
from oauth_cli_kit import OPENAI_CODEX_PROVIDER # noqa: F401
except ImportError:
raise SystemExit('pip install oauth-cli-kit then re-run login') Try / catch
try:
provider = _load_codex_oauth_provider()
except RuntimeError as e:
if 'oauth-cli-kit' in str(e):
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'oauth-cli-kit'])
provider = _load_codex_oauth_provider()
else:
raise Prevention
- Bundle oauth-cli-kit wherever Codex login is offered
- Verify the active interpreter matches the install target
When it happens
Trigger: Invoking login_openai_codex or _refresh_codex_token when oauth-cli-kit is missing; the message also embeds the recommended login command to re-run after installing.
Common situations: Same as other oauth-cli-kit errors: dependency not installed in the active environment; stale venv after switching branches that changed extras.
Understand the failure class
Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.
Related errors
- oauth-cli-kit is not installed. Run: pip install oauth-cli-k
- No supported file-lock backend for Codex OAuth refresh
- The Vibe-Trading Codex OAuth session was invalidated
- The Codex backend rejected the access token and refresh did
- OpenAI Codex OAuth only supports https://chatgpt.com/backend
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/b3e43c5ae139b61f.
Report an issue: GitHub.