BerriAI/litellm · error · ValueError
Either credential_values or model_id must be set
Error message
Either credential_values or model_id must be set
What it means
Pydantic model_validator on CreateCredentialItem: both credential_values and model_id were left unset, so the credential row would carry neither secret material nor a model binding — one of the two must be present for the record to be meaningful.
Source
Thrown at litellm/models/credentials.py:28
class CredentialBase(BaseModel):
credential_name: str
credential_info: dict
class CredentialItem(CredentialBase):
credential_values: dict
class CreateCredentialItem(CredentialBase):
credential_values: dict | None = None
model_id: str | None = None
@model_validator(mode="before")
@classmethod
def check_credential_params(cls, values):
if not values.get("credential_values") and not values.get("model_id"):
raise ValueError("Either credential_values or model_id must be set")
return values
View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set either credential_values (the actual credentials) or model_id when constructing the credentials record.
- Check the caller to ensure at least one of the two fields is populated.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/models/credentials.py:28 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/4b871e281f646523.
Report an issue: GitHub.