BerriAI/litellm · error · HTTPException

Invalid Langfuse host

Error message

Invalid Langfuse host

What it means

Post-parse scheme/host validation of the Langfuse base URL: the string parsed as a URL but its scheme is not http/https or it has no host component (e.g. 'https://' alone). Distinguishes structurally-bad hosts from URLs that parse yet remain unusable as a proxy target.

Source

Thrown at litellm/proxy/vertex_ai_endpoints/langfuse_endpoints.py:68

            return decoded
        previous = decoded


def _normalize_langfuse_base_url(base_target_url: str) -> str:
    if not (base_target_url.startswith("http://") or base_target_url.startswith("https://")):
        # Existing behavior allows host-only Langfuse settings.
        base_target_url = "http://" + base_target_url

    try:
        base_url: Final = httpx.URL(base_target_url)
    except Exception as e:
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail={"error": f"Invalid Langfuse host: {e}"},
        )

    if base_url.scheme not in ("http", "https") or not base_url.host:
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail={"error": "Invalid Langfuse host"},
        )

    if base_url.userinfo:
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail={"error": "Langfuse host must not include credentials"},
        )

    return str(base_url)


def _validate_langfuse_proxy_path(endpoint: str) -> str:
    decoded_endpoint: Final = _decode_to_convergence(endpoint)
    if any(ord(char) < 32 for char in decoded_endpoint):
        raise HTTPException(
            status_code=status.HTTP_400_BAD_REQUEST,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide a well-formed Langfuse host URL (scheme + host).
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/vertex_ai_endpoints/langfuse_endpoints.py:68 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/889ce6a562ad4494. Report an issue: GitHub.