infiniflow/ragflow · error · ValueError
Querit count must be an integer greater than or equal to 1.
Error message
Querit count must be an integer greater than or equal to 1.
What it means
ValueError from _validate_search_inputs(): the 'count' parameter of Querit search must be a strict int (type(count) is int, excluding bool) and >= 1. Floats, numeric strings, None, booleans, and zero/negative values raise.
Source
Thrown at agent/tools/querit.py:406
if not isinstance(response_data, dict):
raise TypeError("Querit API response must be a JSON object.")
if "results" in response_data and not isinstance(response_data["results"], list):
raise TypeError("Querit API response field results must be an array.")
if "statuses" in response_data and not isinstance(response_data["statuses"], list):
raise TypeError("Querit API response field statuses must be an array.")
def _validate_search_inputs(
count: Any,
chunks_per_doc: Any,
time_range: Any,
site_include: Any,
site_exclude: Any,
country_include: Any,
language_include: Any,
) -> None:
if type(count) is not int or count < 1:
raise ValueError("Querit count must be an integer greater than or equal to 1.")
if chunks_per_doc is not None and (type(chunks_per_doc) is not int or not 1 <= chunks_per_doc <= 3):
raise ValueError("Querit chunks_per_doc must be an integer from 1 to 3.")
if type(time_range) is not str:
raise ValueError("Querit time_range must be a string.")
if time_range and not TIME_RANGE_PATTERN.fullmatch(time_range):
raise ValueError("Querit time_range must use dN, wN, mN, yN, or YYYY-MM-DDtoYYYY-MM-DD.")
for name, value in (
("site_include", site_include),
("site_exclude", site_exclude),
("country_include", country_include),
("language_include", language_include),
):
if not isinstance(value, list) or any(not isinstance(item, str) for item in value):
raise ValueError(f"Querit {name} must be an array of strings.")
def _safe_error_message(error: Exception, api_key: str) -> str:
message = str(error) or error.__class__.__name__View on GitHub (pinned to 554fb1133a)
Solutions
- Pass count as a plain int >= 1, e.g. count=10.
- Coerce in your caller: count = int(count) after validating it is numeric and positive.
- Check for numpy scalars — wrap with int(np.int64_value) before invoking.
- Default missing values to a sane positive constant rather than None.
Example fix
# before count = "10" # ValueError # after count = int(count) if str(count).isdigit() else 10
Defensive patterns
Strategy: validation
Validate before calling
def safe_querit_count(v) -> int:
return max(1, int(v)) if str(v).lstrip('-').replace('.','',1).isdigit() else 10 Type guard
def is_valid_querit_count(v) -> bool:
return type(v) is int and v >= 1 Try / catch
try:
querit_search._invoke(query=q, count=n)
except ValueError as e:
if "count" in str(e):
n = 10; querit_search._invoke(query=q, count=n)
raise Prevention
- Convert numeric strings and numpy ints with int() at the boundary.
- Use UI numeric inputs with min=1.
- Default missing count to 10 instead of None.
When it happens
Trigger: count=10.0 (float from JSON config), count="10" (string from a form), count=None when the field is omitted, count=0 from an upstream node defaulting to zero, count=True passing isinstance but failing type().
Common situations: Canvas input fields delivering strings; agent parameter interpolation; Python callers passing math.ceil() results (float in some paths) or numpy ints.
Related errors
- Querit urls must contain between 1 and 10 non-empty strings.
- Querit urls must be absolute HTTP or HTTPS URLs.
- Querit format must be text, markdown, or html.
- Querit crawl_timeout must be an integer from 1 to 60.
- Querit extras_meta must be a boolean.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/3cfa54dd7c5eef90.
Report an issue: GitHub.