#30437 LiteLLM_TeamMembership.litellm_budget_table missing default = None causes HTTP 401 on team member budget check
## Description
When a team member with `budget_id = NULL` makes an API request and has non-zero spend, LiteLLM returns HTTP 401 with a Pydantic validation error instead of processing the request.
## Error Message Authentication Error, 1 validation error for LiteLLM_TeamMembership litellm_budget_table Field required [type=missing, input_value={'user_id': '...', 'spend': 4.73, ...}, input_type=dict]
## Root Cause `LiteLLM_TeamMembership.litellm_budget_table` is declared as `Optional[Union[...]]` without a default value in `litellm/proxy/_types.py`: ```python # Current (broken in Pydantic v2) litellm_budget_table: Optional[Union[LiteLLM_BudgetTableFull, LiteLLM_BudgetTable]] In Pydantic v1, Optional[X] implicitly defaulted to None. In Pydantic v2, Optional[X] without a default is treated as a required field.
Full Bug Chain get_team_membership() in auth_checks.py queries DB and constructs LiteLLM_TeamMembership(**response.dict()) — succeeds because dict() includes litellm_budget_table: None explicitly. The object is stored in cache via UserApiKeyCache.async_set_cache(model_type=LiteLLM_TeamMembership), which calls CacheCodec.serialize() → model_dump(mode="json", exclude_none=True).…