BerriAI/litellm · error · HTTPException

CLI login session not found or expired. Run `litellm-proxy l

Error message

CLI login session not found or expired. Run `litellm-proxy login` again. If this happens immediately after starting a login, the proxy is likely running multiple replicas without a shared cache; configure a Redis cache so every replica can see the login session.

What it means

Error "CLI login session not found or expired. Run `litellm-proxy login` again. If this happens immediately after starting a login, the proxy is likely running multiple replicas without a shared cache; configure a Redis cache so every replica can see the login session." thrown in BerriAI/litellm.

Source

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

    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,
        )
        raise HTTPException(
            status_code=400,
            detail=(
                "CLI login session not found or expired. Run `litellm-proxy login` again. "
                "If this happens immediately after starting a login, the proxy is likely running multiple "
                "replicas without a shared cache; configure a Redis cache "
                "so every replica can see the login session."
            ),
        )
    return flow


def _set_cli_sso_flow(login_id: str, cache: DualCache, flow: dict) -> None:
    cache_key: Final = _get_cli_sso_flow_cache_key(login_id)
    redis_cache: Final = cache.redis_cache
    if redis_cache is not None:
        redis_cache.set_cache(key=cache_key, value=json.dumps(flow), ttl=CLI_SSO_SESSION_TTL_SECONDS)
    else:
        cache.set_cache(key=cache_key, value=flow, ttl=CLI_SSO_SESSION_TTL_SECONDS)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Run `litellm-proxy login` again; if the proxy runs multiple replicas, configure a shared Redis cache so sessions are visible to all replicas.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/ui_sso.py:419 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/15c66bedfe6d653e. Report an issue: GitHub.