BerriAI/litellm · error · ProxyException

End User Id={end_user_id} does not exist in db

Error message

End User Id={end_user_id} does not exist in db

What it means

GET /customer/info looks end_user_id up in LiteLLM_EndUserTable via find_first; when no row matches it raises a 404 not_found ProxyException echoing the requested id (param=end_user_id). This is a clean not-found signal, not a server fault.

Source

Thrown at litellm/proxy/management_endpoints/customer_endpoints.py:534

        -H 'Authorization: Bearer sk-1234'
    ```
    """
    try:
        from litellm.proxy.proxy_server import prisma_client

        if prisma_client is None:
            raise HTTPException(
                status_code=500,
                detail={"error": CommonProxyErrors.db_not_connected_error.value},
            )

        user_info: Final = await _typed_table(EndUserRepository(prisma_client)).find_first(
            where={"user_id": end_user_id},
            include={"litellm_budget_table": True, "object_permission": True},
        )

        if user_info is None:
            raise ProxyException(
                message=f"End User Id={end_user_id} does not exist in db",
                type="not_found",
                code=404,
                param="end_user_id",
            )

        return _to_customer_response(user_info)

    except Exception as e:
        verbose_proxy_logger.exception(
            "litellm.proxy.management_endpoints.customer_endpoints.end_user_info(): Exception occured - %s", e
        )
        raise handle_exception_on_proxy(e)


@router.post(
    "/customer/update",
    tags=["Customer Management"],

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. List customers with GET /customer/list (admin) and copy the exact user_id
  2. Create the customer first via POST /customer/new if it should exist
  3. Normalize ids (strip whitespace, stable casing) on both create and lookup
Defensive patterns

Strategy: try-catch

Try / catch

import httpx


def get_customer_or_none(base: str, headers: dict, end_user_id: str) -> dict | None:
    r = httpx.get(f"{base}/customer/info", params={"end_user_id": end_user_id}, headers=headers)
    if r.status_code == 404:
        return None
    r.raise_for_status()
    return r.json()

Prevention

When it happens

Trigger: GET /customer/info?end_user_id=X where X was never created, was deleted via /customer/delete, or differs by casing/whitespace from the stored user_id.

Common situations: Lookups by ids from an external CRM that were never synced into LiteLLM; queries after cleanup jobs deleted end users; copy-paste or URL-encoding mistakes in ids.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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