BerriAI/litellm · error · HTTPException

Authentication Error: invalid user key - user key does not e

Error message

Authentication Error: invalid user key - user key does not exist in db. User Key={token}

What it means

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.

Source

Thrown at litellm/proxy/utils.py:3610

                        hashed_token = _hash_token_if_needed(token=token)
                        verbose_proxy_logger.debug("PrismaClient: find_unique for token: %s", hashed_token)
                if query_type == "find_unique" and hashed_token is not None:
                    if token is None:
                        raise HTTPException(
                            status_code=400,
                            detail={"error": f"No token passed in. Token={token}"},
                        )
                    response = await VerificationTokenRepository(self).table.find_unique(
                        where={"token": hashed_token},
                        include={"litellm_budget_table": True},
                    )
                    if response is not None:
                        # for prisma we need to cast the expires time to str
                        if response.expires is not None and isinstance(response.expires, datetime):
                            response.expires = response.expires.isoformat()
                    else:
                        # Token does not exist.
                        raise HTTPException(
                            status_code=status.HTTP_401_UNAUTHORIZED,
                            detail=f"Authentication Error: invalid user key - user key does not exist in db. User Key={token}",
                        )
                elif query_type == "find_all" and user_id is not None:
                    response = await VerificationTokenRepository(self).table.find_many(
                        where={"user_id": user_id},
                        include={"litellm_budget_table": True},
                    )
                    if response is not None and len(response) > 0:
                        for r in response:
                            if isinstance(r.expires, datetime):
                                r.expires = r.expires.isoformat()
                elif query_type == "find_all" and team_id is not None:
                    response = await VerificationTokenRepository(self).table.find_many(
                        take=limit,
                        where={"team_id": team_id},
                        include={"litellm_budget_table": True},
                    )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use a valid virtual key that exists in the database; create one via /key/generate if needed.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/utils.py:3610 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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