{"record":{"id":"15c66bedfe6d653e","repo":"BerriAI/litellm","slug":"cli-login-session-not-found-or-expired-run-litel","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/ui_sso.py","lineNumber":419,"sourceCode":"\n    cache_key: Final = _get_cli_sso_flow_cache_key(cast(str, login_id))\n    redis_cache: Final = cache.redis_cache\n    if redis_cache is not None:\n        flow = redis_cache.get_cache(key=cache_key)\n    else:\n        flow = cache.get_cache(key=cache_key)\n    if isinstance(flow, str):\n        try:\n            flow = _as_object(json.loads(flow))\n        except ValueError:\n            flow = None\n    if not isinstance(flow, dict) or \"poll_secret_hash\" not in flow:\n        verbose_proxy_logger.warning(\n            \"CLI SSO login session not found in cache for login_id=%s. If the proxy runs multiple replicas, \"\n            \"a shared Redis cache is required for CLI login to work.\",\n            login_id,\n        )\n        raise HTTPException(\n            status_code=400,\n            detail=(\n                \"CLI login session not found or expired. Run `litellm-proxy login` again. \"\n                \"If this happens immediately after starting a login, the proxy is likely running multiple \"\n                \"replicas without a shared cache; configure a Redis cache \"\n                \"so every replica can see the login session.\"\n            ),\n        )\n    return flow\n\n\ndef _set_cli_sso_flow(login_id: str, cache: DualCache, flow: dict) -> None:\n    cache_key: Final = _get_cli_sso_flow_cache_key(login_id)\n    redis_cache: Final = cache.redis_cache\n    if redis_cache is not None:\n        redis_cache.set_cache(key=cache_key, value=json.dumps(flow), ttl=CLI_SSO_SESSION_TTL_SECONDS)\n    else:\n        cache.set_cache(key=cache_key, value=flow, ttl=CLI_SSO_SESSION_TTL_SECONDS)","sourceCodeStart":401,"sourceCodeEnd":437,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/ui_sso.py#L401-L437","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/ui_sso.py:419 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `litellm-proxy login` again; if the proxy runs multiple replicas, configure a shared Redis cache so sessions are visible to all replicas."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}