infiniflow/ragflow · error · ValueError

{} not supported, should be one of {}

Error message

 {} not supported, should be one of {}

What it means

Raised by ComponentParamBase.check_defined_type in agent/component/base.py when the value's exact type name (type(param).__name__) is not in the caller-provided types list of type-name strings. It is a type whitelist check, stricter than isinstance: subclasses with different __name__s and JSON-deserialized primitives that kept string form will fail. The message lists the offending value and the accepted type names.

Source

Thrown at agent/component/base.py:306

    @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=""):
        if type(param).__name__ != "str":
            raise ValueError(description + " {} not supported, should be one of {}".format(param, valid_list))

        lower_param = param.lower()
        if lower_param in valid_list:
            return lower_param
        else:
            raise ValueError(description + " {} not supported, should be one of {}".format(param, valid_list))

    @staticmethod
    def _greater_equal_than(value, limit):
        return value >= limit - settings.FLOAT_ZERO

    @staticmethod
    def _less_equal_than(value, limit):

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Match the parameter's Python type to one of the names printed in the message (e.g. 'str', 'list', 'dict')
  2. Parse stringified JSON before validation: json.loads(value) if isinstance(value, str) and value.startswith(('[','{'))
  3. Use the description prefix in the message to locate the exact component field to fix in the canvas configuration

Example fix

# before
self.urls = "[\"https://a\"]"  # str, but types=["list"]

# after
import json
self.urls = json.loads(self.urls)  # actual list
Defensive patterns

Strategy: type-guard

Validate before calling

def coerce_to_type(v, type_names):
    import json
    if type(v).__name__ in type_names:
        return v
    if isinstance(v, str) and v.startswith(('[', '{')):
        try:
            parsed = json.loads(v)
            if type(parsed).__name__ in type_names:
                return parsed
        except json.JSONDecodeError:
            pass
    if type_names == ['str']:
        return str(v)
    raise TypeError(f"expected one of {type_names}, got {type(v).__name__}")

Type guard

def matches_defined_types(v, type_names) -> bool:
    return type(v).__name__ in type_names

Try / catch

try:
    component._param.check()
except ValueError as e:
    logger.error('Type validation failed: %s', e)
    raise

Prevention

When it happens

Trigger: A component check() calls check_defined_type(self.some_param, desc, ['str','list','dict']) and the value is e.g. an int where a str was expected, a dict where a list was expected, or a stringified JSON ('["a"]') that was never parsed. Fires when the canvas component parameters are validated.

Common situations: Frontend sends JSON fields as strings; nested config edited by hand in the canvas JSON where a list became a scalar; version changes that switched a parameter's accepted type; None defaults not replaced.

Related errors


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