HKUDS/Vibe-Trading · error · RuntimeError
oauth-cli-kit is not installed. Run: pip install oauth-cli-k
Error message
oauth-cli-kit is not installed. Run: pip install oauth-cli-kit
What it means
_build_codex_token_storage imports FileTokenStorage from oauth_cli_kit to build the Vibe-owned token cache; the ImportError is re-raised with an install command. Every Codex OAuth token operation needs this storage class.
Source
Thrown at agent/src/providers/openai_codex.py:105
def __init__(self, detail: str, *, status_code: int | None, permanent: bool) -> None:
super().__init__(detail)
self.status_code = status_code
self.permanent = permanent
def _build_codex_token_storage(path: Path | None = None) -> Any:
"""Build the Vibe-owned Codex token store.
The path deliberately does not use oauth-cli-kit's default storage, because
that backend imports and copies ``~/.codex/auth.json``. A copied rotating
refresh token gives two processes ownership of one OAuth session and causes
the ``token_invalidated`` / ``refresh_token_reused`` failure in issue #975.
"""
try:
from oauth_cli_kit.storage import FileTokenStorage
except ImportError as exc:
raise RuntimeError("oauth-cli-kit is not installed. Run: pip install oauth-cli-kit") from exc
token_path = path or (get_runtime_root() / "auth" / _CODEX_TOKEN_FILENAME)
class VibeCodexTokenStorage(FileTokenStorage):
def get_token_path(self) -> Path:
return token_path
return VibeCodexTokenStorage(
token_filename=_CODEX_TOKEN_FILENAME,
app_name="vibe-trading",
import_codex_cli=False,
)
def _clear_codex_token(storage: Any) -> None:
"""Remove only Vibe's invalid credential cache."""
try:
storage.get_token_path().unlink(missing_ok=True)View on GitHub (pinned to 80ffdda44c)
Solutions
- pip install oauth-cli-kit
- Confirm the install exposes storage: python -c "from oauth_cli_kit.storage import FileTokenStorage"
- Re-run the login command afterwards
Example fix
# before RuntimeError: oauth-cli-kit is not installed. Run: pip install oauth-cli-kit # after pip install oauth-cli-kit
Defensive patterns
Strategy: try-catch
Validate before calling
try:
from oauth_cli_kit.storage import FileTokenStorage # noqa: F401
except ImportError:
raise SystemExit('pip install oauth-cli-kit') Try / catch
try:
storage = _build_codex_token_storage()
except RuntimeError as e:
if 'oauth-cli-kit' in str(e):
print('Run: pip install oauth-cli-kit'); sys.exit(1)
raise Prevention
- Include oauth-cli-kit in the deployment image when Codex OAuth is used
- Add a preflight check before login/streaming flows
When it happens
Trigger: Calling login_openai_codex or any token read/refresh (_get_codex_token) when oauth-cli-kit is not installed in the environment.
Common situations: Running the agent's Codex login or streaming flow in an env where only core deps were installed; dependency pruning in Docker images removed the OAuth kit.
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
- OpenAI Codex OAuth requires oauth-cli-kit. Install dependenc
- Anthropic provider requires langchain-anthropic. Install the
- langchain-openai is not installed
- No supported file-lock backend for Codex OAuth refresh
- The Vibe-Trading Codex OAuth session was invalidated
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/48918b08173ec81f.
Report an issue: GitHub.