infiniflow/ragflow · error · ValueError

{} not supported, should be bool type

Error message

 {} not supported, should be bool type

What it means

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.

Source

Thrown at agent/component/base.py:291

    @staticmethod
    def check_positive_number(param, description):
        if type(param).__name__ not in ["float", "int", "long"] or param <= 0:
            raise ValueError(description + " {} not supported, should be positive numeric".format(param))

    @staticmethod
    def check_nonnegative_number(param, description):
        if type(param).__name__ not in ["float", "int", "long"] or param < 0:
            raise ValueError(description + " {} not supported, should be non-negative numeric".format(param))

    @staticmethod
    def check_decimal_float(param, description):
        if type(param).__name__ not in ["float", "int"] or param < 0 or param > 1:
            raise ValueError(description + " {} not supported, should be a float number in range [0, 1]".format(param))

    @staticmethod
    def check_boolean(param, description):
        if type(param).__name__ != "bool":
            raise ValueError(description + " {} not supported, should be bool type".format(param))

    @staticmethod
    def check_open_unit_interval(param, description):
        if type(param).__name__ not in ["float"] or param <= 0 or param >= 1:
            raise ValueError(description + " should be a numeric number between 0 and 1 exclusively")

    @staticmethod
    def check_valid_value(param, description, valid_values):
        if param not in valid_values:
            raise ValueError(description + " {} is not supported, it should be in {}".format(param, valid_values))

    @staticmethod
    def check_defined_type(param, description, types):
        if type(param).__name__ not in types:
            raise ValueError(description + " {} not supported, should be one of {}".format(param, types))

    @staticmethod
    def check_and_change_lower(param, valid_list, description=""):

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Use a literal JSON boolean (true/false, unquoted) for the parameter in the canvas/config
  2. If the value comes from a string source, convert before validation: param = str(v).lower() in ('true', '1')
  3. Identify the failing field from the description prefix in the message and fix it in the component configuration UI or JSON

Example fix

# before
"stream": "true"

# after
"stream": true
Defensive patterns

Strategy: validation

Validate before calling

def as_bool(v, name):
    if isinstance(v, bool):
        return v
    if isinstance(v, str) and v.lower() in ('true', 'false'):
        return v.lower() == 'true'
    raise TypeError(f"{name} must be a bool, got {type(v).__name__}")

stream = as_bool(config.get('stream', False), 'stream')

Type guard

def is_bool(v) -> bool:
    return isinstance(v, bool)

Try / catch

try:
    component._param.check()
except ValueError as e:
    if 'should be bool type' in str(e):
        # coerce and retry once
        param.field = bool(param.field)
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/8984b9c2167ad619. Report an issue: GitHub.