{"record":{"id":"df35ad20f5499b60","repo":"infiniflow/ragflow","slug":"should-be-a-numeric-number-between-0-and-1-exclus","errorCode":null,"errorMessage":" should be a numeric number between 0 and 1 exclusively","messagePattern":" should be a numeric number between 0 and 1 exclusively","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/component/base.py","lineNumber":296,"sourceCode":"    @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):\n        if type(param).__name__ not in [\"float\"] or param <= 0 or param >= 1:\n            raise ValueError(description + \" should be a numeric number between 0 and 1 exclusively\")\n\n    @staticmethod\n    def check_valid_value(param, description, valid_values):\n        if param not in valid_values:\n            raise ValueError(description + \" {} is not supported, it should be in {}\".format(param, valid_values))\n\n    @staticmethod\n    def check_defined_type(param, description, types):\n        if type(param).__name__ not in types:\n            raise ValueError(description + \" {} not supported, should be one of {}\".format(param, types))\n\n    @staticmethod\n    def check_and_change_lower(param, valid_list, description=\"\"):\n        if type(param).__name__ != \"str\":\n            raise ValueError(description + \" {} not supported, should be one of {}\".format(param, valid_list))\n\n        lower_param = param.lower()\n        if lower_param in valid_list:","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/component/base.py#L278-L314","documentation":"Raised by ComponentParamBase.check_open_unit_interval in agent/component/base.py when a parameter must be strictly inside (0, 1): the value's exact type name must be 'float' (ints are rejected here, unlike check_decimal_float) and it must satisfy 0 < param < 1. This targets values like sampling 'presence penalty'-style ratios where 0 and 1 are both invalid. Minor caveat: unlike sibling validators, this message does not interpolate the offending value, so only the description prefix identifies the parameter.","triggerScenarios":"A parameter validated with check_open_unit_interval is passed 0 or 1 (boundary values are excluded), an int like 1 (type name 'int' fails even if 0 < 1), a string \"0.5\", or a negative/ >1 number. Fires during the component check() pass when the canvas is saved or executed.","commonSituations":"Users copying a value that worked for a [0,1]-closed-interval field (check_decimal_float) into an open-interval field; setting diversity/nucleus-sampling knobs to 1 or 0 intending 'fully on/off'; string-typed values from hand-edited JSON.","solutions":["Set the parameter to a strict float strictly between 0 and 1, e.g. 0.9 (not 1, not 0, not an int)","If the semantic you want is 'disabled', check whether the component supports leaving the field empty or 0 via a different parameter instead of 0 here","Coerce string inputs to float(value) before assignment if config comes from a text source"],"exampleFix":"# before\n\"diversity\": 1\n\n# after\n\"diversity\": 0.9","handlingStrategy":"validation","validationCode":"def as_open_unit_interval(v, name):\n    if not isinstance(v, float):\n        v = float(v)  # ints are rejected by the validator; force float\n    if not (0.0 < v < 1.0):\n        raise ValueError(f\"{name} must be strictly between 0 and 1, got {v}\")\n    return v","typeGuard":"def in_open_unit_interval(v) -> bool:\n    return isinstance(v, float) and 0.0 < v < 1.0","tryCatchPattern":"try:\n    component._param.check()\nexcept ValueError as e:\n    logger.error('Validation: %s (field identified by prefix only; value not shown)', e)\n    raise","preventionTips":["Remember 0 and 1 are invalid for open-interval fields — pick e.g. 0.001/0.999 if near-boundary behavior is needed","Use a float literal (0.9), not an int, for these parameters","Note this error message omits the offending value — rely on the description prefix to find the field"],"tags":["validation","agent-component","range-check","python"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}