BerriAI/litellm · error · ValueError

input needs to be a dictionary

Error message

input needs to be a dictionary

What it means

Pydantic model_validator guard on MemberBase: the team-member input was not a dict (e.g. a list or scalar was posted), so field lookups like values.get('user_id') would fail. The raw input shape is at fault, not any member field.

Source

Thrown at litellm/models/team.py:33

from litellm.models.object_permission import LiteLLM_ObjectPermissionTable
from litellm.types.llms.base import LiteLLMPydanticObjectBase


class MemberBase(LiteLLMPydanticObjectBase):
    user_id: str | None = Field(
        default=None,
        description="The unique ID of the user to add. Either user_id or user_email must be provided",
    )
    user_email: str | None = Field(
        default=None,
        description="The email address of the user to add. Either user_id or user_email must be provided",
    )

    @model_validator(mode="before")
    @classmethod
    def check_user_info(cls, values):
        if not isinstance(values, dict):
            raise ValueError("input needs to be a dictionary")
        if values.get("user_id") is None and values.get("user_email") is None:
            raise ValueError("Either user id or user email must be provided")
        return values


class Member(MemberBase):
    role: Literal["admin", "user"] = Field(
        description="The role of the user within the team. 'admin' users can manage team settings and members, 'user' is a regular team member"
    )


class BudgetLimitEntry(LiteLLMPydanticObjectBase):
    """A single budget window with its own limit and independent reset schedule."""

    budget_duration: str
    max_budget: float
    reset_at: datetime | None = None

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass the team input as a dictionary matching the expected schema.
  2. If you have a JSON string or another type, parse/convert it to a dict first.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at litellm/models/team.py:33 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/daa88f7992e9cb17. Report an issue: GitHub.