{"record":{"id":"4b871e281f646523","repo":"BerriAI/litellm","slug":"either-credential-values-or-model-id-must-be-set","errorCode":null,"errorMessage":"Either credential_values or model_id must be set","messagePattern":"Either credential_values or model_id must be set","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/models/credentials.py","lineNumber":28,"sourceCode":"\nclass CredentialBase(BaseModel):\n    credential_name: str\n    credential_info: dict\n\n\nclass CredentialItem(CredentialBase):\n    credential_values: dict\n\n\nclass CreateCredentialItem(CredentialBase):\n    credential_values: dict | None = None\n    model_id: str | None = None\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def check_credential_params(cls, values):\n        if not values.get(\"credential_values\") and not values.get(\"model_id\"):\n            raise ValueError(\"Either credential_values or model_id must be set\")\n        return values\n","sourceCodeStart":10,"sourceCodeEnd":30,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/models/credentials.py#L10-L30","documentation":"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.","triggerScenarios":"Thrown at litellm/models/credentials.py:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}