BerriAI/litellm · error · ValueError

message must be non-empty when the banner is enabled

Error message

message must be non-empty when the banner is enabled

What it means

Pydantic model_validator on UserBannerUpdate: the request sets enabled=true but leaves message empty. A visible banner with no text is meaningless for the dashboard, so the whole payload is rejected at validation time; either supply non-empty message text or set enabled=false.

Source

Thrown at litellm/proxy/ui_crud_endpoints/user_banner_endpoints.py:38

class UserBannerUpdate(BaseModel):
    enabled: bool = Field(
        default=False,
        description="If true, the banner is shown to all authenticated dashboard users.",
    )
    message: str = Field(
        default="",
        max_length=USER_BANNER_MAX_MESSAGE_LENGTH,
        description="Banner text shown to dashboard users. Markdown is supported.",
    )
    severity: UserBannerSeverity = Field(
        default="info",
        description="Visual style of the banner.",
    )

    @model_validator(mode="after")
    def _require_message_when_enabled(self) -> "UserBannerUpdate":
        if self.enabled and not self.message.strip():
            raise ValueError("message must be non-empty when the banner is enabled")
        return self


class UserBanner(UserBannerUpdate):
    revision: str = Field(
        default="",
        description=(
            "Server-stamped opaque publish identity; a fresh value is generated on every "
            "update so clients re-surface dismissed banners on republish."
        ),
    )


class UpdateUserBannerResponse(BaseModel):
    message: str
    banner: UserBanner

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Provide a non-empty message when enabling the banner, or disable the banner.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/ui_crud_endpoints/user_banner_endpoints.py:38 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/80bfe90fc61c9921. Report an issue: GitHub.