BerriAI/litellm · error · Exception

DB not connected. prisma_client is None

Error message

DB not connected. prisma_client is None

What it means

Error "DB not connected. prisma_client is None" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4234

                prisma_client=prisma_client,
                user_api_key_dict=user_api_key_dict,
                litellm_changed_by=litellm_changed_by,
            )

            if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value:
                deleted_tokens = await prisma_client.delete_data(tokens=tokens)
                if deleted_tokens is not None and len(deleted_tokens) != len(tokens):
                    failed_tokens = [token for token in tokens if token not in deleted_tokens]
            else:
                deletion_tasks: Final = [prisma_client.delete_data(tokens=[key.token]) for key in authorized_keys]
                await asyncio.gather(*deletion_tasks)

                deleted_tokens = [key.token for key in authorized_keys]
                if len(deleted_tokens) != len(tokens):
                    failed_tokens = [token for token in tokens if token not in deleted_tokens]

        else:
            raise Exception("DB not connected. prisma_client is None")
    except Exception as e:
        verbose_proxy_logger.exception(
            "litellm.proxy.proxy_server.delete_verification_tokens(): Exception occured - %s", e
        )
        verbose_proxy_logger.debug(traceback.format_exc())
        raise e

    for key in tokens:
        user_api_key_cache.delete_cache(key)
        # remove hash token from cache
        hashed_token = hash_token(cast(str, key))
        user_api_key_cache.delete_cache(hashed_token)

    # After credential invalidation, so a failure here can never keep a deleted key alive.
    for deleted_key in authorized_keys:
        if deleted_key.token is not None:
            await sync_key_access_group_membership(
                prisma_client=prisma_client,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set DATABASE_URL to a valid PostgreSQL connection string and restart the proxy.
  2. Check proxy startup logs for database connection failures.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:4234 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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