BerriAI/litellm · error · ValueError

Prisma client is not initialized. Database connection requir

Error message

Prisma client is not initialized. Database connection required for LiteLLM skills.

What it means

The LiteLLM Proxy skills feature persists custom skills in the litellm_skillstable via Prisma. Every handler operation first fetches the proxy server's prisma_client; if the server started without a DATABASE_URL (no Postgres), prisma_client is None and the handler raises ValueError. Skills CRUD is simply unavailable without a database.

Source

Thrown at litellm/llms/litellm_proxy/skills/handler.py:58

    data: Final = prisma_skill.model_dump()

    if data.get("file_content") is not None:
        if isinstance(data["file_content"], str):
            data["file_content"] = base64.b64decode(data["file_content"])

    return LiteLLM_SkillsTable(**data)


class LiteLLMSkillsHandler:
    """CRUD for skills stored in ``litellm_skillstable``."""

    @staticmethod
    async def _get_prisma_client():
        from litellm.proxy.proxy_server import prisma_client

        if prisma_client is None:
            raise ValueError("Prisma client is not initialized. Database connection required for LiteLLM skills.")
        return prisma_client

    @staticmethod
    async def create_skill(
        data: NewSkillRequest,
        user_id: str | None = None,
        user_api_key_dict: UserAPIKeyAuth | None = None,
    ) -> LiteLLM_SkillsTable:
        prisma_client: Final = await LiteLLMSkillsHandler._get_prisma_client()

        skill_id: Final = f"{LITELLM_SKILL_ID_PREFIX}{uuid.uuid4()}"
        owner: Final = get_primary_resource_owner_scope(user_api_key_dict) or user_id
        if owner is None:
            # Identity-less callers (no user_id / team_id / org_id /
            # api_key / token) can't be uniquely stamped on the row.
            # Stamping a placeholder would let any two such callers see
            # each other's skills via the shared owner. ValueError keeps
            # this module FastAPI-free per the project layering rule.

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Configure a Postgres database: set DATABASE_URL in the proxy environment and restart so Prisma connects
  2. Remove --disable_database / ensure the startup logs show a successful Prisma connection
  3. Retry the skills request once the proxy logs confirm 'Prisma client connected'

Example fix

# before: proxy started without a DB
litellm --config config.yaml  # no DATABASE_URL

# after
export DATABASE_URL="postgresql://user:pass@host:5432/litellm"
litellm --config config.yaml
Defensive patterns

Strategy: try-catch

Validate before calling

async def skills_available() -> bool:
    from litellm.proxy.proxy_server import prisma_client
    return prisma_client is not None

Try / catch

try:
    skill = await LiteLLMSkillsHandler.create_skill(data=payload, user_api_key_dict=auth)
except ValueError as e:
    if "Prisma client is not initialized" in str(e):
        raise RuntimeError("Skills require a Postgres DB: set DATABASE_URL and restart the proxy") from e

Prevention

When it happens

Trigger: Calling any skills API endpoint (create/get/update/delete skill) on a LiteLLM proxy instance started without DATABASE_URL, so Prisma never initialized; database disabled via --disable_database or the equivalent config.

Common situations: Running the proxy in demo/local mode with no Postgres and then trying the skills routes; DATABASE_URL present but database connection failed at startup, leaving prisma_client None; test harness booting only part of the server.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/83a7ba8027dacdb7. Report an issue: GitHub.