{"record":{"id":"15146091c5efe3cf","repo":"BerriAI/litellm","slug":"field-field-should-be-a-valid-dictionary-151460","errorCode":null,"errorMessage":"Field {field} should be a valid dictionary","messagePattern":"Field (.+?) should be a valid dictionary","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/_types.py","lineNumber":1215,"sourceCode":"        if values.get(\"token\") is not None:\n            values.update({\"key\": values.get(\"token\")})\n        dict_fields: Final = [\n            \"metadata\",\n            \"aliases\",\n            \"config\",\n            \"permissions\",\n            \"model_max_budget\",\n            \"budget_fallbacks\",\n            \"router_settings\",\n            \"budget_limits\",\n        ]\n        for field in dict_fields:\n            value = values.get(field)\n            if value is not None and isinstance(value, str):\n                try:\n                    values[field] = json.loads(value)\n                except json.JSONDecodeError:\n                    raise ValueError(f\"Field {field} should be a valid dictionary\")\n\n        return values\n\n\nclass UpdateKeyRequest(KeyRequestBase):\n    # Note: the defaults of all Params here MUST BE NONE\n    # else they will get overwritten\n    duration: str | None = None\n    spend: float | None = None\n    metadata: dict | None = None\n    temp_budget_increase: float | None = None\n    temp_budget_expiry: datetime | None = None\n    auto_rotate: bool | None = None\n    rotation_interval: str | None = None\n    organization_id: str | None = None\n\n    @model_validator(mode=\"after\")\n    def validate_temp_budget(self) -> \"UpdateKeyRequest\":","sourceCodeStart":1197,"sourceCodeEnd":1233,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_types.py#L1197-L1233","documentation":"Proxy config normalization tries to json.loads string values of dict-typed fields (metadata, aliases, config, permissions, etc.); when parsing fails the field stays a string and this error reports the field that could not be coerced to a dictionary.","triggerScenarios":"Thrown at litellm/proxy/_types.py:1215 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a dictionary (object) for the indicated field."],"exampleFix":"field={\"key\": \"value\"}","handlingStrategy":"type-guard","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"}