infiniflow/ragflow · error · ValueError
{} not supported, should be positive integer
Error message
{} not supported, should be positive integer What it means
check_positive_integer raises when a param is not an int (or 'long') or is <= 0. Used for values where zero is meaningless — e.g. sequence lengths, page sizes, batch sizes.
Source
Thrown at agent/component/base.py:271
@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):
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):View on GitHub (pinned to 554fb1133a)
Solutions
- Set the value to an int >= 1.
- Cast/validate the type at the source so the component receives a real int.
- Add client-side minimum checks (min=1) on the corresponding form inputs.
- If zero should be legal for your component's semantics, the param should use check_nonnegative_integer instead — change the validator, not the data.
Example fix
# before
params = {"max_tokens": 0}
# after
params = {"max_tokens": 1024} Defensive patterns
Strategy: type-guard
Validate before calling
def to_pos_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 >= 1')
return v Type guard
def is_pos_int(v) -> bool:
return isinstance(v, int) and not isinstance(v, bool) and v >= 1 Try / catch
try:
param.check()
except ValueError as e:
if 'should be positive integer' in str(e):
conf[field] = max(1, int(conf[field]))
param.update(conf); param.check() Prevention
- Set form minimums to 1 for these fields.
- Never default positive-integer params to 0 in templates.
- If zero should be valid, the component should use check_nonnegative_integer — fix the validator, not the data.
When it happens
Trigger: A component check() calling check_positive_integer(param, description) with 0, a negative number, a float, or a numeric string.
Common situations: Defaulting a field to 0 'for now' and running the canvas; string-typed numerics from forms/APIs; copying configs where a different validator allowed 0.
Related errors
- {} not supported, should be 0 or 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/4dab24478aa5fb1c.
Report an issue: GitHub.