{"record":{"id":"30003cbf4686070a","repo":"BerriAI/litellm","slug":"authentication-error-invalid-user-key-user-key","errorCode":null,"errorMessage":"Authentication Error: invalid user key - user key does not exist in db. User Key={token}","messagePattern":"Authentication Error: invalid user key - user key does not exist in db\\. User Key=(.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"litellm/proxy/utils.py","lineNumber":3610,"sourceCode":"                        hashed_token = _hash_token_if_needed(token=token)\n                        verbose_proxy_logger.debug(\"PrismaClient: find_unique for token: %s\", hashed_token)\n                if query_type == \"find_unique\" and hashed_token is not None:\n                    if token is None:\n                        raise HTTPException(\n                            status_code=400,\n                            detail={\"error\": f\"No token passed in. Token={token}\"},\n                        )\n                    response = await VerificationTokenRepository(self).table.find_unique(\n                        where={\"token\": hashed_token},\n                        include={\"litellm_budget_table\": True},\n                    )\n                    if response is not None:\n                        # for prisma we need to cast the expires time to str\n                        if response.expires is not None and isinstance(response.expires, datetime):\n                            response.expires = response.expires.isoformat()\n                    else:\n                        # Token does not exist.\n                        raise HTTPException(\n                            status_code=status.HTTP_401_UNAUTHORIZED,\n                            detail=f\"Authentication Error: invalid user key - user key does not exist in db. User Key={token}\",\n                        )\n                elif query_type == \"find_all\" and user_id is not None:\n                    response = await VerificationTokenRepository(self).table.find_many(\n                        where={\"user_id\": user_id},\n                        include={\"litellm_budget_table\": True},\n                    )\n                    if response is not None and len(response) > 0:\n                        for r in response:\n                            if isinstance(r.expires, datetime):\n                                r.expires = r.expires.isoformat()\n                elif query_type == \"find_all\" and team_id is not None:\n                    response = await VerificationTokenRepository(self).table.find_many(\n                        take=limit,\n                        where={\"team_id\": team_id},\n                        include={\"litellm_budget_table\": True},\n                    )","sourceCodeStart":3592,"sourceCodeEnd":3628,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/utils.py#L3592-L3628","documentation":"Prisma-specific integrity error surfaced during key operations: the update targets a LiteLLM_VerificationToken row whose token hash doesn't exist in the table (e.g. updating a deleted key). The client library reports the missing record; the operation should re-check that the key still exists before updating.","triggerScenarios":"Thrown at litellm/proxy/utils.py:3610 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid virtual key that exists in the database; create one via /key/generate if needed."],"exampleFix":null,"handlingStrategy":"validation","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"}