{"record":{"id":"21c158d7d9202040","repo":"BerriAI/litellm","slug":"timeout-must-be-numeric-got-v-r","errorCode":null,"errorMessage":"timeout must be numeric, got {v!r}","messagePattern":"timeout must be numeric, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/types/guardrails.py","lineNumber":1018,"sourceCode":"    VigilGuardGuardrailConfigModel,\n    SingulrGuardrailConfigModel,\n):\n    guardrail: str = Field(description=\"The type of guardrail integration to use\")\n    mode: str | list[str] | Mode = Field(\n        description=\"When to apply the guardrail (pre_call, post_call, during_call, logging_only)\"\n    )\n\n    @field_validator(\"timeout\", mode=\"before\", check_fields=False)\n    @classmethod\n    def coerce_timeout(cls, v):\n        \"\"\"Accept string-valued timeouts (dashboard UI sends JSON strings)\n        and coerce to float before any handler reads the value.\"\"\"\n        if v is None or v == \"\":\n            return None\n        try:\n            return float(v)\n        except (TypeError, ValueError) as e:\n            raise ValueError(f\"timeout must be numeric, got {v!r}\") from e\n\n    def __init__(self, **kwargs) -> None:\n        default_on: Final = kwargs.pop(\"default_on\", None)\n        if default_on is not None:\n            kwargs[\"default_on\"] = default_on\n        else:\n            kwargs[\"default_on\"] = False\n\n        super().__init__(**kwargs)\n\n    def __contains__(self, key) -> bool:\n        # Define custom behavior for the 'in' operator\n        return hasattr(self, key)\n\n    def get(self, key, default=None):\n        # Custom .get() method to access attributes with a default value if the attribute doesn't exist\n        return getattr(self, key, default)\n","sourceCodeStart":1000,"sourceCodeEnd":1036,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/types/guardrails.py#L1000-L1036","documentation":"Pydantic field_validator coercing the guardrail timeout: the dashboard UI sends JSON string timeouts, and a value arrived that is neither None, empty, nor numeric-coercible, so it cannot be converted to float.","triggerScenarios":"Thrown at litellm/types/guardrails.py:1018 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a numeric timeout (int/float seconds), not {v!r}.","Parse string input with float() before validation."],"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-14T00:17:10.932Z"}