{"record":{"id":"555007fc6b8c68c7","repo":"infiniflow/ragflow","slug":"not-supported-should-be-positive-numeric","errorCode":null,"errorMessage":" {} not supported, should be positive numeric","messagePattern":" (.+?) not supported, should be positive numeric","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/component/base.py","lineNumber":276,"sourceCode":"    @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):\n        if type(param).__name__ != \"bool\":\n            raise ValueError(description + \" {} not supported, should be bool type\".format(param))\n\n    @staticmethod\n    def check_open_unit_interval(param, description):","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/component/base.py#L258-L294","documentation":"check_positive_number raises when a param is not float/int/long or is <= 0. Enforces strictly positive numeric values such as thresholds, scores, rates, and epsilon values.","triggerScenarios":"A component check() calling check_positive_number(param, description) with 0, a negative number, or a non-numeric type (string, None, bool-driven edge cases).","commonSituations":"Similarity threshold or keyword-similarity score set to 0 to 'disable' filtering (validator requires > 0); string numerics from hand-edited configs; None defaults passed through when a field is left unset.","solutions":["Set the value to a positive number (e.g. 0.2 for a threshold).","If you intended 'no filtering', use the component's dedicated disable flag if one exists — do not use 0 as a sentinel here.","Coerce numeric strings with float() before they reach the component.","Guard None/empty inputs upstream so they never reach the validator."],"exampleFix":"# before\nparams = {\"similarity_threshold\": 0.0}\n\n# after\nparams = {\"similarity_threshold\": 0.2}","handlingStrategy":"type-guard","validationCode":"def to_pos_number(v, field):\n    if isinstance(v, bool) or not isinstance(v, (int, float)):\n        raise ValueError(f'{field} must be numeric')\n    if v <= 0:\n        raise ValueError(f'{field} must be > 0')\n    return v","typeGuard":"def is_pos_number(v) -> bool:\n    return isinstance(v, (int, float)) and not isinstance(v, bool) and v > 0","tryCatchPattern":"try:\n    param.check()\nexcept ValueError as e:\n    if 'should be positive numeric' in str(e):\n        raise ValueError(f'{field} needs a value > 0; use the disable flag instead of 0') from e\n    raise","preventionTips":["Do not use 0 to disable threshold-gated behavior; use the component's dedicated disable option.","Coerce numeric strings with float() before submitting configs.","Set form minimums to a small positive epsilon where relevant."],"tags":["canvas","type-validation","parameter-validation","numeric"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}