{"record":{"id":"1821b65042a0296e","repo":"BerriAI/litellm","slug":"num-must-be-between-num-min-and-num-max-got","errorCode":null,"errorMessage":"num must be between {NUM_MIN} and {NUM_MAX}, got {self.num}","messagePattern":"num must be between (.+?) and (.+?), got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/apiserpent/search/defaults.py","lineNumber":47,"sourceCode":"    the rest are always sent so behavior is deterministic regardless of any\n    server-side defaults.\n    \"\"\"\n\n    engine: SearchEngine = \"google\"\n    country: str = \"us\"\n    num: int = 10\n    format: ResponseFormat = \"full\"\n    pages: int | None = None\n    freshness: Freshness | None = None\n    safe: SafeSearch | None = None\n    language: str | None = None\n    pixel_position: bool | None = None\n\n    def __post_init__(self) -> None:\n        # num's deep-search floor (NUM_MIN_DEEP) is endpoint-specific and enforced\n        # in the transform layer; here we only bound the absolute range.\n        if not NUM_MIN <= self.num <= NUM_MAX:\n            raise ValueError(f\"num must be between {NUM_MIN} and {NUM_MAX}, got {self.num}\")\n        if self.pages is not None and not PAGES_MIN <= self.pages <= PAGES_MAX:\n            raise ValueError(f\"pages must be between {PAGES_MIN} and {PAGES_MAX}, got {self.pages}\")\n\n    def to_request_params(self) -> dict:\n        \"\"\"Return non-None fields as request params, booleans lowercased.\"\"\"\n        params: Final[dict] = {}\n        for key, value in asdict(self).items():\n            if value is None:\n                continue\n            params[key] = str(value).lower() if isinstance(value, bool) else value\n        return params\n\n    @classmethod\n    def field_names(cls) -> set:\n        return set(cls.__dataclass_fields__.keys())\n\n\nQUICK_SEARCH_PATH: Final = \"/api/search/quick\"","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/apiserpent/search/defaults.py#L29-L65","documentation":"Error \"num must be between {NUM_MIN} and {NUM_MAX}, got {self.num}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/apiserpent/search/defaults.py:47 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set num within the allowed range shown in the error (NUM_MIN..NUM_MAX)."],"exampleFix":null,"handlingStrategy":null,"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-23T08:17:48.524Z"}