{"record":{"id":"9509234e06763926","repo":"BerriAI/litellm","slug":"end-user-id-end-user-id-does-not-exist-in-db","errorCode":null,"errorMessage":"End User Id={end_user_id} does not exist in db","messagePattern":"End User Id=(.+?) does not exist in db","errorType":"http","errorClass":"ProxyException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/management_endpoints/customer_endpoints.py","lineNumber":534,"sourceCode":"        -H 'Authorization: Bearer sk-1234'\n    ```\n    \"\"\"\n    try:\n        from litellm.proxy.proxy_server import prisma_client\n\n        if prisma_client is None:\n            raise HTTPException(\n                status_code=500,\n                detail={\"error\": CommonProxyErrors.db_not_connected_error.value},\n            )\n\n        user_info: Final = await _typed_table(EndUserRepository(prisma_client)).find_first(\n            where={\"user_id\": end_user_id},\n            include={\"litellm_budget_table\": True, \"object_permission\": True},\n        )\n\n        if user_info is None:\n            raise ProxyException(\n                message=f\"End User Id={end_user_id} does not exist in db\",\n                type=\"not_found\",\n                code=404,\n                param=\"end_user_id\",\n            )\n\n        return _to_customer_response(user_info)\n\n    except Exception as e:\n        verbose_proxy_logger.exception(\n            \"litellm.proxy.management_endpoints.customer_endpoints.end_user_info(): Exception occured - %s\", e\n        )\n        raise handle_exception_on_proxy(e)\n\n\n@router.post(\n    \"/customer/update\",\n    tags=[\"Customer Management\"],","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/customer_endpoints.py#L516-L552","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["List customers with GET /customer/list (admin) and copy the exact user_id","Create the customer first via POST /customer/new if it should exist","Normalize ids (strip whitespace, stable casing) on both create and lookup"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"import httpx\n\n\ndef get_customer_or_none(base: str, headers: dict, end_user_id: str) -> dict | None:\n    r = httpx.get(f\"{base}/customer/info\", params={\"end_user_id\": end_user_id}, headers=headers)\n    if r.status_code == 404:\n        return None\n    r.raise_for_status()\n    return r.json()","preventionTips":["Handle 404 from /customer/info as a normal 'missing' branch, not an error to alert on","Sync external ids into LiteLLM at creation time rather than assuming they exist","Trim and canonicalize ids before querying to avoid phantom not-founds"],"tags":["litellm","not-found","customer-management","http-404"],"backgroundTag":"resource-not-found","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}