infiniflow/ragflow · error · ValueError

Querit {name} must be an array of strings.

Error message

Querit {name} must be an array of strings.

What it means

In _validate_search_inputs (agent/tools/querit.py:419-420), each of site_include, site_exclude, country_include, language_include must be a Python list whose every element is a str. The check is strict: None fails isinstance(None, list), so the parameters must be actual arrays even when empty. The f-string interpolates the offending parameter name into the message.

Source

Thrown at agent/tools/querit.py:420

    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__
    return message.replace(api_key, "[REDACTED]") if api_key else message


def _querit_text(value: Any) -> str:
    return "" if value is None else str(value)

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Always use JSON arrays of strings for these four fields, e.g. "site_include": ["wikipedia.org"], and [] when you want no filtering.
  2. Never pass null/None - the validator rejects it; use an empty list instead.
  3. If the value comes from another component's output, wrap or coerce it: list of strings before it reaches Querit.
  4. Check every element's type - one non-string element (e.g. a number) fails the whole array.

Example fix

// before
"site_include": null,
"country_include": "us"

// after
"site_include": [],
"country_include": ["us"]
Defensive patterns

Strategy: type-guard

Validate before calling

def normalize_str_array(v):
    if v is None:
        return []
    if isinstance(v, str):
        return [v]
    if isinstance(v, list):
        return [str(x) for x in v]
    raise TypeError(f"expected list of strings, got {type(v).__name__}")

site_include = normalize_str_array(site_include)

Type guard

def is_str_array(value) -> bool:
    return isinstance(value, list) and all(isinstance(item, str) for item in value)

Try / catch

try:
    querit.run(site_include=si)
except ValueError as e:
    if "array of strings" in str(e):
        querit.run(site_include=[])

Prevention

When it happens

Trigger: Passing null/None instead of [] for any of the four filter parameters; passing a single string like 'wikipedia.org' instead of ['wikipedia.org']; passing a list containing numbers, booleans, dicts, or nested lists; JSON tool arguments where the field is an object instead of an array.

Common situations: LLM tool-calls emit a bare string for a one-element filter; a workflow upstream component outputs a scalar into a field the canvas expects as an array; JSON config written by hand uses null for 'no filter'.

Related errors


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