{"record":{"id":"b1927f619765dbb8","repo":"BerriAI/litellm","slug":"authentication-error-invalid-user-key-token-doe","errorCode":null,"errorMessage":"Authentication Error: invalid user key - token does not exist","messagePattern":"Authentication Error: invalid user key - token does not exist","errorType":"http","errorClass":"HTTPException","httpStatus":401,"severity":"error","filePath":"litellm/proxy/utils.py","lineNumber":3675,"sourceCode":"                            hashed_tokens: Final = []\n                            for t in token:\n                                assert isinstance(t, str)\n                                if t.startswith(\"sk-\"):\n                                    new_token = self.hash_token(token=t)\n                                    hashed_tokens.append(new_token)\n                                else:\n                                    hashed_tokens.append(t)\n                            where_filter[\"token\"][\"in\"] = hashed_tokens\n                    response = await VerificationTokenRepository(self).table.find_many(\n                        order={\"spend\": \"desc\"},\n                        where=where_filter,\n                        include={\"litellm_budget_table\": True},\n                    )\n                if response is not None:\n                    return response\n                else:\n                    # Token does not exist.\n                    raise HTTPException(\n                        status_code=status.HTTP_401_UNAUTHORIZED,\n                        detail=\"Authentication Error: invalid user key - token does not exist\",\n                    )\n            elif (user_id is not None and table_name is None) or (table_name is not None and table_name == \"user\"):\n                if query_type == \"find_unique\":\n                    if key_val is None:\n                        key_val = {\"user_id\": user_id}\n\n                    response = await UserRepository(self).table.find_unique(\n                        where=key_val,\n                        include={\"organization_memberships\": True},\n                    )\n\n                elif query_type == \"find_all\" and key_val is not None:\n                    response = await UserRepository(self).table.find_many(where=key_val)\n                elif query_type == \"find_all\" and reset_at is not None:\n                    response = await UserRepository(self).table.find_many(\n                        take=limit,","sourceCodeStart":3657,"sourceCodeEnd":3693,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/utils.py#L3657-L3693","documentation":"Prisma record-not-found error while updating token rows: the token update references a key that no longer exists in LiteLLM_VerificationToken. The client surfaces this as a database-level failure rather than a 404, so callers should verify the key exists before retrying the update.","triggerScenarios":"Thrown at litellm/proxy/utils.py:3675 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a valid existing token; check for typos or revoked/expired keys."],"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"}