BerriAI/litellm · error · Exception

Unexpected litellm_params type: {type(existing_params)}

Error message

Unexpected litellm_params type: {type(existing_params)}

What it means

The deployment's stored litellm_params came back from Prisma in an unexpected shape (not the dict the code expects), so merging the tag would risk corrupting the config; the helper raises 500 naming the actual type. At-fault condition is unexpected DB payload typing.

Source

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

        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)

        # Update database with modified params (keeps encrypted fields encrypted)
        await ModelRepository(prisma_client).table.update(
            where={"model_id": deployment.model_info.id},
            data={"litellm_params": json.dumps(existing_params)},
        )
    except Exception as e:
        verbose_proxy_logger.exception("Error adding tag to deployment: %s", e)
        raise HTTPException(status_code=500, detail=str(e))


@router.post(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Inspect the model's litellm_params in the DB; it has an unexpected type. Re-create the model if corrupted.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/tag_management_endpoints.py:376 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/5f630423523182f4. Report an issue: GitHub.