BerriAI/litellm · error · HTTPException

Invalid verification code

Error message

Invalid verification code

What it means

Error "Invalid verification code" thrown in BerriAI/litellm.

Source

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

    )
    from litellm.proxy.proxy_server import cli_sso_session_cache

    flow: Final = _get_cli_sso_flow_or_raise(login_id=login_id, cache=cli_sso_session_cache)
    if not flow.get("sso_complete") or not flow.get("session_data"):
        raise HTTPException(status_code=400, detail="CLI login is not ready")

    body: Final = (await request.body()).decode("utf-8")
    form_values: Final = parse_qs(body)
    supplied_user_code: Final = (form_values.get("user_code") or [""])[0]
    supplied_browser_complete_token: Final = (form_values.get("browser_complete_token") or [""])[0]
    supplied_user_code_hash: Final = _hash_cli_sso_secret(_normalize_cli_sso_user_code(supplied_user_code))
    supplied_browser_complete_token_hash: Final = _hash_cli_sso_secret(supplied_browser_complete_token)

    expected_user_code_hash: Final = flow.get("user_code_hash")
    if not isinstance(expected_user_code_hash, str) or not secrets.compare_digest(
        supplied_user_code_hash, expected_user_code_hash
    ):
        raise HTTPException(status_code=400, detail="Invalid verification code")

    expected_browser_complete_token_hash: Final = flow.get("browser_complete_token_hash")
    if not isinstance(expected_browser_complete_token_hash, str) or not secrets.compare_digest(
        supplied_browser_complete_token_hash, expected_browser_complete_token_hash
    ):
        raise HTTPException(status_code=400, detail="Invalid verification code")

    flow["user_code_verified"] = True
    _set_cli_sso_flow(login_id=login_id, cache=cli_sso_session_cache, flow=flow)

    html_content: Final = render_cli_sso_success_page()
    return HTMLResponse(content=html_content, status_code=200)


def normalize_email(email: str | None) -> str | None:
    """
    Normalize email address to lowercase for consistent storage and comparison.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Re-enter the verification code shown in the browser/CLI login flow, or restart the login.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/ui_sso.py:817 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/5342a75cdfe7686f. Report an issue: GitHub.