BerriAI/litellm · error · HTTPException

Model {deployment.model_info.id} not found in database

Error message

Model {deployment.model_info.id} not found in database

What it means

The deployment referenced by the tag (deployment.model_info.id) has no row in the LiteLLM_ProxyModelTable; the tag cannot be attached to a model the DB does not know, so a 404 naming the model id is raised.

Source

Thrown at litellm/proxy/management_endpoints/tag_management_endpoints.py:365

        }
    except Exception as e:
        verbose_proxy_logger.exception("Error creating tag: %s", e)
        raise HTTPException(status_code=500, detail=str(e))


async def _add_tag_to_deployment(deployment: "Deployment", tag: str):
    """Helper function to add tag to deployment"""
    from litellm.proxy.proxy_server import prisma_client

    if prisma_client is None:
        raise HTTPException(status_code=500, detail="Database not connected")

    try:
        # Get current model from database to preserve encrypted fields
        db_model = await ModelRepository(prisma_client).table.find_unique(where={"model_id": deployment.model_info.id})

        if db_model is None:
            raise HTTPException(
                status_code=404,
                detail=f"Model {deployment.model_info.id} not found in database",
            )

        # Prisma returns litellm_params as dict (already parsed from JSON)
        existing_params = db_model.litellm_params
        if isinstance(existing_params, str):
            # If it's a string, parse it
            existing_params = json.loads(existing_params)
        elif not isinstance(existing_params, dict):
            raise Exception(f"Unexpected litellm_params type: {type(existing_params)}")

        # Add tag to tags array (preserve encryption of other fields)
        if "tags" not in existing_params:
            existing_params["tags"] = []
        if tag not in existing_params["tags"]:
            existing_params["tags"].append(tag)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the deployment's model id exists in the database via /model/info.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/tag_management_endpoints.py:365 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/001ce43c679b16a4. Report an issue: GitHub.