BerriAI/litellm · error · HTTPException

Prisma client not initialized

Error message

Prisma client not initialized

What it means

Raised in the agent creation endpoint when the proxy_server.prisma_client singleton is None — the proxy started without DATABASE_URL, so there is no database to persist agents in. Returned as HTTP 500; the fix is connecting a Postgres database to the proxy, not changing the request.

Source

Thrown at litellm/proxy/agent_endpoints/endpoints.py:412

                        "tags": ["hello world"],
                        "examples": ["hi", "hello world"]
                    }
                ]
            },
            "litellm_params": {
                "make_public": true
            }
        }'
    ```
    """
    await check_feature_access_for_user(user_api_key_dict, "agents")

    from litellm.proxy.proxy_server import prisma_client

    _check_agent_management_permission(user_api_key_dict)

    if prisma_client is None:
        raise HTTPException(status_code=500, detail="Prisma client not initialized")

    try:
        # Get the user ID from the API key auth
        created_by: Final = user_api_key_dict.user_id or "unknown"

        # check for naming conflicts
        existing_agent: Final = AGENT_REGISTRY.get_agent_by_name(agent_name=request.get("agent_name"))
        if existing_agent is not None:
            raise HTTPException(
                status_code=400,
                detail=f"Agent with name {request.get('agent_name')} already exists",
            )

        # Apply the LiteLLM-fronting merge only when the admin actually
        # provided an agent card. Plain chat/LLM agents register without
        # ``agent_card_params``, and synthesising a default A2A card for them
        # would advertise capabilities (``supportedInterfaces``, security
        # schemes, default skills) the agent doesn't actually expose.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Connect a database (set DATABASE_URL) so the Prisma client initializes.

Example fix

export DATABASE_URL='postgresql://...'
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/agent_endpoints/endpoints.py:412 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/2f4f7917803a65af. Report an issue: GitHub.