BerriAI/litellm · error · HTTPException

Invalid CLI login session id

Error message

Invalid CLI login session id

What it means

Error "Invalid CLI login session id" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/ui_sso.py:400

    )
    if current_attempts > _CLI_SSO_START_RATE_LIMIT_MAX_ATTEMPTS:
        raise HTTPException(
            status_code=429,
            detail="Too many CLI login attempts. Try again later.",
        )


def _get_cli_sso_flow_or_raise(login_id: str | None, cache: DualCache) -> dict:
    if isinstance(login_id, str) and login_id.startswith("sk-"):
        raise HTTPException(
            status_code=400,
            detail=(
                "Your litellm CLI is out of date and uses a login flow this proxy no longer supports. "
                "Upgrade it with `pip install -U 'litellm[proxy]'` and run `litellm-proxy login` again."
            ),
        )
    if not _is_valid_cli_sso_login_id(login_id):
        raise HTTPException(status_code=400, detail="Invalid CLI login session id")

    cache_key: Final = _get_cli_sso_flow_cache_key(cast(str, login_id))
    redis_cache: Final = cache.redis_cache
    if redis_cache is not None:
        flow = redis_cache.get_cache(key=cache_key)
    else:
        flow = cache.get_cache(key=cache_key)
    if isinstance(flow, str):
        try:
            flow = _as_object(json.loads(flow))
        except ValueError:
            flow = None
    if not isinstance(flow, dict) or "poll_secret_hash" not in flow:
        verbose_proxy_logger.warning(
            "CLI SSO login session not found in cache for login_id=%s. If the proxy runs multiple replicas, "
            "a shared Redis cache is required for CLI login to work.",
            login_id,
        )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Run `litellm-proxy login` again to start a fresh CLI login session.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/ui_sso.py:400 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/ec0d080d19a3201b. Report an issue: GitHub.