infiniflow/ragflow · error · ValueError

{} not supported, should be positive numeric

Error message

 {} not supported, should be positive numeric

What it means

check_positive_number raises when a param is not float/int/long or is <= 0. Enforces strictly positive numeric values such as thresholds, scores, rates, and epsilon values.

Source

Thrown at agent/component/base.py:276

    @staticmethod
    def check_empty(param, description):
        if not param:
            raise ValueError(description + " does not support empty value.")

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

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

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

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Set the value to a positive number (e.g. 0.2 for a threshold).
  2. If you intended 'no filtering', use the component's dedicated disable flag if one exists — do not use 0 as a sentinel here.
  3. Coerce numeric strings with float() before they reach the component.
  4. Guard None/empty inputs upstream so they never reach the validator.

Example fix

# before
params = {"similarity_threshold": 0.0}

# after
params = {"similarity_threshold": 0.2}
Defensive patterns

Strategy: type-guard

Validate before calling

def to_pos_number(v, field):
    if isinstance(v, bool) or not isinstance(v, (int, float)):
        raise ValueError(f'{field} must be numeric')
    if v <= 0:
        raise ValueError(f'{field} must be > 0')
    return v

Type guard

def is_pos_number(v) -> bool:
    return isinstance(v, (int, float)) and not isinstance(v, bool) and v > 0

Try / catch

try:
    param.check()
except ValueError as e:
    if 'should be positive numeric' in str(e):
        raise ValueError(f'{field} needs a value > 0; use the disable flag instead of 0') from e
    raise

Prevention

When it happens

Trigger: A component check() calling check_positive_number(param, description) with 0, a negative number, or a non-numeric type (string, None, bool-driven edge cases).

Common situations: Similarity threshold or keyword-similarity score set to 0 to 'disable' filtering (validator requires > 0); string numerics from hand-edited configs; None defaults passed through when a field is left unset.

Related errors


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