{"record":{"id":"31fc6225ddf6180b","repo":"mlflow/mlflow","slug":"invalid-parameter-value-31fc62","errorCode":"INVALID_PARAMETER_VALUE","errorMessage":"Invalid value {max_results} for parameter 'max_results' supplied. It must be a positive integer","messagePattern":"Invalid value (.+?) for parameter 'max_results' supplied\\. It must be a positive integer","errorType":"error_code","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/store/tracking/file_store.py","lineNumber":363,"sourceCode":"            exp\n            for exp in exp_list\n            if not exp.endswith(FileStore.TRASH_FOLDER_NAME)\n            and exp != ModelRegistryFileStore.MODELS_FOLDER_NAME\n        ]\n\n    def _get_deleted_experiments(self, full_path=False):\n        return list_subdirs(self.trash_folder, full_path)\n\n    def search_experiments(\n        self,\n        view_type=ViewType.ACTIVE_ONLY,\n        max_results=SEARCH_MAX_RESULTS_DEFAULT,\n        filter_string=None,\n        order_by=None,\n        page_token=None,\n    ):\n        if not isinstance(max_results, int) or max_results < 1:\n            raise MlflowException(\n                f\"Invalid value {max_results} for parameter 'max_results' supplied. It must be \"\n                f\"a positive integer\",\n                INVALID_PARAMETER_VALUE,\n            )\n        if max_results > SEARCH_MAX_RESULTS_THRESHOLD:\n            raise MlflowException(\n                f\"Invalid value {max_results} for parameter 'max_results' supplied. It must be at \"\n                f\"most {SEARCH_MAX_RESULTS_THRESHOLD}\",\n                INVALID_PARAMETER_VALUE,\n            )\n\n        self._check_root_dir()\n        experiment_ids = []\n        if view_type in (ViewType.ACTIVE_ONLY, ViewType.ALL):\n            experiment_ids += self._get_active_experiments(full_path=False)\n        if view_type in (ViewType.DELETED_ONLY, ViewType.ALL):\n            experiment_ids += self._get_deleted_experiments(full_path=False)\n","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/store/tracking/file_store.py#L345-L381","documentation":"FileStore.search_experiments validates max_results: it must be a positive int, and raises MlflowException with INVALID_PARAMETER_VALUE otherwise (a separate threshold check enforces the upper bound). This prevents nonsensical pagination sizes in the file-backed search implementation.","triggerScenarios":"Calling search_experiments with max_results=0, a negative number, a non-int (e.g., string from CLI args or float), or an int-like numpy type.","commonSituations":"Passing command-line/config strings without int() conversion; computing page size with arithmetic that yields 0; copying max_results from a config file as a string.","solutions":["Pass a positive integer, e.g., max_results=int(config_value) with a >= 1 check.","Clamp to the allowed range (1..SEARCH_MAX_RESULTS_THRESHOLD) before calling.","Fix upstream config parsing to emit ints, not strings."],"exampleFix":"// before\nmlflow.search_experiments(max_results=argv.page_size)\n// after\nsize = int(argv.page_size)\nassert size >= 1\nmlflow.search_experiments(max_results=size)","handlingStrategy":"validation","validationCode":"def valid_max_results(v) -> int:\n    n = int(v)\n    if n < 1:\n        raise ValueError(\"max_results must be a positive integer\")\n    return n","typeGuard":"def is_positive_int(v) -> bool:\n    return isinstance(v, int) and not isinstance(v, bool) and v >= 1","tryCatchPattern":"from mlflow.exceptions import MlflowException\ntry:\n    exps = mlflow.search_experiments(max_results=n)\nexcept MlflowException as e:\n    if e.error_code == \"INVALID_PARAMETER_VALUE\":\n        exps = mlflow.search_experiments(max_results=100)","preventionTips":["Coerce and validate numeric CLI/config inputs before store calls","Use the documented default max_results when unsure","Add parameter validation tests for search helpers"],"tags":["validation","pagination","parameters"],"backgroundTag":"invalid-parameter-value","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}