infiniflow/ragflow · error · ValueError

{} is not supported, it should be in {}

Error message

 {} is not supported, it should be in {}

What it means

Raised by ComponentParamBase.check_valid_value in agent/component/base.py when a parameter's value is not a member of the caller-supplied valid_values list. This is an enum-style whitelist check used for parameters like output formats, engines, or modes. The message shows the offending value and the allowed list, making it self-diagnosing.

Source

Thrown at agent/component/base.py:301

    @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=""):
        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

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Read the message: it prints the allowed list — set the parameter to exactly one of those values, matching case
  2. If you believe the value should be valid, check the component source for the current valid_values list at your RAGFlow version and align
  3. Normalize input with str(value).strip().lower() if the whitelist is lowercase before assigning the param

Example fix

# before
self.check_valid_value(self.output_format, "fmt", ["pdf", "docx"])
output_format = "PDF"

# after
output_format = "pdf"
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED_FORMATS = ['pdf', 'docx', 'txt', 'markdown', 'html']

fmt = config.get('output_format')
if fmt not in ALLOWED_FORMATS:
    raise ValueError(f"output_format must be one of {ALLOWED_FORMATS}, got {fmt!r}")

Type guard

def is_valid_choice(v, choices) -> bool:
    return v in choices

Try / catch

try:
    component._param.check()
except ValueError as e:
    # message contains the allowed list; surface it to the config UI
    report_config_error(str(e))

Prevention

When it happens

Trigger: Calling a component whose check() does e.g. check_valid_value(self.output_format, '...', ['pdf','docx','txt','markdown','html']) with a value not in that exact list — wrong casing ('PDF'), a typo ('mkardown'), an empty string, or a value valid in a newer/older version but not the current one.

Common situations: Version drift: a valid option removed or renamed between RAGFlow releases; case-sensitive values entered by hand; frontend dropdown out of sync with backend whitelist; localized values ('pdf' vs 'PDF').

Related errors


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