infiniflow/ragflow · error · ValueError
{} not supported, should be 0 or positive integer
Error message
{} not supported, should be 0 or positive integer What it means
check_nonnegative_integer raises when a param is not an int type (note: it accepts the legacy name 'long') or is negative. Enforces counts, limits, and sizes that may be zero but not negative.
Source
Thrown at agent/component/base.py:266
raise ValueError("Please check runtime conf, {} = {} does not match user-parameter restriction".format(variable, value))
elif variable in validation_json:
self._validate_param(attr, validation_json)
@staticmethod
def check_string(param, description):
if type(param).__name__ not in ["str"]:
raise ValueError(description + " {} not supported, should be string type".format(param))
@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):View on GitHub (pinned to 554fb1133a)
Solutions
- Set the value to an int >= 0 (if 'unlimited' semantics are needed, use the component's documented max or a large int, not -1).
- Coerce types at the boundary: int(value) before it reaches the component.
- Fix UI inputs to emit proper numeric types.
- Check for float drift in computed configs and round/cast to int.
Example fix
# before
params = {"top_n": "5"} # string -> fails
# before
params = {"top_n": -1} # negative -> fails
# after
params = {"top_n": 5} Defensive patterns
Strategy: type-guard
Validate before calling
def to_nonneg_int(v, field):
if isinstance(v, bool) or not isinstance(v, int):
raise ValueError(f'{field} must be int')
if v < 0:
raise ValueError(f'{field} must be >= 0')
return v Type guard
def is_nonneg_int(v) -> bool:
return isinstance(v, int) and not isinstance(v, bool) and v >= 0 Try / catch
try:
param.check()
except ValueError as e:
if 'should be 0 or positive integer' in str(e):
conf[field] = max(0, int(conf[field])) # coerce then re-check
param.update(conf); param.check() Prevention
- Use numeric form inputs (type=number, min=0) for these params.
- Cast with int() at the config boundary; remember bool passes isinstance(v, int).
- Do not use -1 as an 'unlimited' sentinel where this validator runs.
When it happens
Trigger: A component check() calling check_nonnegative_integer(param, description) where param is e.g. -1, a float like 1.5, or a string like "10" — top_n, retries, timeout counts, memory limits.
Common situations: Config forms returning strings for numeric inputs; passing -1 as a 'no limit' sentinel the validator does not accept; floats leaking in from computed values; YAML unquoted values parsing oddly.
Related errors
- {} not supported, should be positive integer
- {} not supported, should be string type
- {} not supported, should be positive numeric
- {} not supported, should be non-negative numeric
- {component_name}: {e}
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/5ba348af4aff882f.
Report an issue: GitHub.