{"record":{"id":"4dab24478aa5fb1c","repo":"infiniflow/ragflow","slug":"not-supported-should-be-positive-integer","errorCode":null,"errorMessage":" {} not supported, should be positive integer","messagePattern":" (.+?) not supported, should be positive integer","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/component/base.py","lineNumber":271,"sourceCode":"    @staticmethod\n    def check_string(param, description):\n        if type(param).__name__ not in [\"str\"]:\n            raise ValueError(description + \" {} not supported, should be string type\".format(param))\n\n    @staticmethod\n    def check_empty(param, description):\n        if not param:\n            raise ValueError(description + \" does not support empty value.\")\n\n    @staticmethod\n    def check_nonnegative_integer(param, description):\n        if type(param).__name__ not in [\"int\", \"long\"] or param < 0:\n            raise ValueError(description + \" {} not supported, should be 0 or positive integer\".format(param))\n\n    @staticmethod\n    def check_positive_integer(param, description):\n        if type(param).__name__ not in [\"int\", \"long\"] or param <= 0:\n            raise ValueError(description + \" {} not supported, should be positive integer\".format(param))\n\n    @staticmethod\n    def check_positive_number(param, description):\n        if type(param).__name__ not in [\"float\", \"int\", \"long\"] or param <= 0:\n            raise ValueError(description + \" {} not supported, should be positive numeric\".format(param))\n\n    @staticmethod\n    def check_nonnegative_number(param, description):\n        if type(param).__name__ not in [\"float\", \"int\", \"long\"] or param < 0:\n            raise ValueError(description + \" {} not supported, should be non-negative numeric\".format(param))\n\n    @staticmethod\n    def check_decimal_float(param, description):\n        if type(param).__name__ not in [\"float\", \"int\"] or param < 0 or param > 1:\n            raise ValueError(description + \" {} not supported, should be a float number in range [0, 1]\".format(param))\n\n    @staticmethod\n    def check_boolean(param, description):","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/component/base.py#L253-L289","documentation":"check_positive_integer raises when a param is not an int (or 'long') or is <= 0. Used for values where zero is meaningless — e.g. sequence lengths, page sizes, batch sizes.","triggerScenarios":"A component check() calling check_positive_integer(param, description) with 0, a negative number, a float, or a numeric string.","commonSituations":"Defaulting a field to 0 'for now' and running the canvas; string-typed numerics from forms/APIs; copying configs where a different validator allowed 0.","solutions":["Set the value to an int >= 1.","Cast/validate the type at the source so the component receives a real int.","Add client-side minimum checks (min=1) on the corresponding form inputs.","If zero should be legal for your component's semantics, the param should use check_nonnegative_integer instead — change the validator, not the data."],"exampleFix":"# before\nparams = {\"max_tokens\": 0}\n\n# after\nparams = {\"max_tokens\": 1024}","handlingStrategy":"type-guard","validationCode":"def to_pos_int(v, field):\n    if isinstance(v, bool) or not isinstance(v, int):\n        raise ValueError(f'{field} must be int')\n    if v <= 0:\n        raise ValueError(f'{field} must be >= 1')\n    return v","typeGuard":"def is_pos_int(v) -> bool:\n    return isinstance(v, int) and not isinstance(v, bool) and v >= 1","tryCatchPattern":"try:\n    param.check()\nexcept ValueError as e:\n    if 'should be positive integer' in str(e):\n        conf[field] = max(1, int(conf[field]))\n        param.update(conf); param.check()","preventionTips":["Set form minimums to 1 for these fields.","Never default positive-integer params to 0 in templates.","If zero should be valid, the component should use check_nonnegative_integer — fix the validator, not the data."],"tags":["canvas","type-validation","parameter-validation","integer"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}