{"record":{"id":"8984b9c2167ad619","repo":"infiniflow/ragflow","slug":"not-supported-should-be-bool-type","errorCode":null,"errorMessage":" {} not supported, should be bool type","messagePattern":" (.+?) not supported, should be bool type","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/component/base.py","lineNumber":291,"sourceCode":"    @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):\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=\"\"):","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/component/base.py#L273-L309","documentation":"Raised by ComponentParamBase.check_boolean in agent/component/base.py when a parameter expected to be a boolean is not of exact type bool. Note that in Python bool is a subclass of int, but this check inspects type(param).__name__, so only True/False pass; 1/0 and 'true'/'false' strings are rejected. The message includes the offending value and the description label of the failing parameter.","triggerScenarios":"A component parameter like 'stream' or 'enable_x' validated with check_boolean receives: the string \"true\" (common from form/JSON input), an integer 1/0, None, or a numpy.bool_. Fires during component check() when the agent canvas is validated or run.","commonSituations":"Frontend form toggles that serialize as strings; hand-written canvas JSON with \"true\" instead of true; API callers passing 1/0 out of habit from other systems; YAML/ENV-derived values that arrive as strings.","solutions":["Use a literal JSON boolean (true/false, unquoted) for the parameter in the canvas/config","If the value comes from a string source, convert before validation: param = str(v).lower() in ('true', '1')","Identify the failing field from the description prefix in the message and fix it in the component configuration UI or JSON"],"exampleFix":"# before\n\"stream\": \"true\"\n\n# after\n\"stream\": true","handlingStrategy":"validation","validationCode":"def as_bool(v, name):\n    if isinstance(v, bool):\n        return v\n    if isinstance(v, str) and v.lower() in ('true', 'false'):\n        return v.lower() == 'true'\n    raise TypeError(f\"{name} must be a bool, got {type(v).__name__}\")\n\nstream = as_bool(config.get('stream', False), 'stream')","typeGuard":"def is_bool(v) -> bool:\n    return isinstance(v, bool)","tryCatchPattern":"try:\n    component._param.check()\nexcept ValueError as e:\n    if 'should be bool type' in str(e):\n        # coerce and retry once\n        param.field = bool(param.field)\n    else:\n        raise","preventionTips":["Use unquoted true/false in canvas JSON","Convert string toggles at the API boundary, not inside components","Never pass 1/0 for boolean fields in this codebase — the type-name check rejects ints"],"tags":["validation","agent-component","type-check","python"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}