infiniflow/ragflow · error · ValueError
{} not supported, should be string type
Error message
{} not supported, should be string type What it means
check_string is a param validator used inside component check() methods: it raises ValueError when the param's runtime type is not exactly 'str' (bool/int/None etc. all fail). The message embeds the caller-provided description plus the offending value.
Source
Thrown at agent/component/base.py:256
validation_dict = validation_json[default_section][variable]
value = getattr(param_obj, variable)
value_legal = False
for op_type in validation_dict:
if self.func[op_type](value, validation_dict[op_type]):
value_legal = True
break
if not value_legal:
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):View on GitHub (pinned to 554fb1133a)
Solutions
- Wrap the value in a string or quote it in YAML/JSON so it deserializes as str.
- Provide the missing value if it is None because the field was never set.
- In component code, gate check_string on the field being set if it is genuinely optional.
- Validate types client-side before submitting the canvas/config.
Example fix
# before
conf = {"api_key": 12345}
# after
conf = {"api_key": "12345"} Defensive patterns
Strategy: type-guard
Validate before calling
def ensure_strings(conf, string_fields):
for f in string_fields:
if f in conf and conf[f] is not None:
conf[f] = str(conf[f])
return conf Type guard
def is_str(v) -> bool:
return type(v).__name__ == 'str' # exact match, excludes bool/int/None Try / catch
try:
param.check()
except ValueError as e:
if 'should be string type' in str(e):
field = parse_field(str(e))
conf[field] = str(conf[field])
param.update(conf); param.check() Prevention
- Quote string-like values in YAML configs to prevent type coercion.
- Apply str() coercion at API boundaries for fields documented as strings.
- Note that check_string rejects bool and None too — not just numbers.
When it happens
Trigger: A component check() calling check_string(param, description) where param is a non-string — e.g. a model id passed as int, None from an unset optional field, or a bool from a config form.
Common situations: YAML/JSON configs coercing values (unquoted yes/no -> bool, numeric-looking ids -> int); optional fields left as None but validated as required strings; API callers sending typed values where strings are expected.
Related errors
- {} not supported, should be 0 or positive integer
- {} not supported, should be positive integer
- {} 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/4ae725c7f140a2ec.
Report an issue: GitHub.