infiniflow/ragflow · error · ValueError

Querit crawl_timeout must be an integer from 1 to 60.

Error message

Querit crawl_timeout must be an integer from 1 to 60.

What it means

ValueError from _validate_contents_inputs(): the crawl_timeout parameter must be an int (bools excluded, note the deliberate use of type() is int) between 1 and 60 seconds. Floats like 2.5, numeric strings like '30', booleans, or out-of-range values raise.

Source

Thrown at agent/tools/querit.py:382


def _normalize_contents_urls(urls: Any) -> Any:
    if isinstance(urls, str):
        return [url.strip() for url in urls.split(",") if url.strip()]
    return urls


def _validate_contents_inputs(urls: Any, format: Any, crawl_timeout: Any, extras_meta: Any) -> None:
    if not isinstance(urls, list) or not 1 <= len(urls) <= 10 or any(not isinstance(url, str) or not url.strip() for url in urls):
        raise ValueError("Querit urls must contain between 1 and 10 non-empty strings.")
    for url in urls:
        parsed = urlparse(url)
        if parsed.scheme not in {"http", "https"} or not parsed.netloc:
            raise ValueError("Querit urls must be absolute HTTP or HTTPS URLs.")
    if format not in QUERIT_CONTENT_FORMATS:
        raise ValueError("Querit format must be text, markdown, or html.")
    if type(crawl_timeout) is not int or not 1 <= crawl_timeout <= 60:
        raise ValueError("Querit crawl_timeout must be an integer from 1 to 60.")
    if type(extras_meta) is not bool:
        raise ValueError("Querit extras_meta must be a boolean.")


def _validate_contents_response(response_data: Any) -> None:
    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,

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Set crawl_timeout to an integer literal between 1 and 60 (e.g. 30).
  2. Coerce in your caller: int(float(value)) then clamp to [1, 60] before invoking.
  3. Remember True/False are rejected — pass real integers.
  4. For slow sites, keep timeout <= 60 and handle pagination/fetch retries yourself.

Example fix

# before
crawl_timeout = "30"  # str -> ValueError

# after
crawl_timeout = int(float("30"))
crawl_timeout = max(1, min(60, crawl_timeout))
Defensive patterns

Strategy: validation

Validate before calling

def safe_crawl_timeout(v) -> int:
    n = int(float(v)) if str(v).replace('.','',1).isdigit() else 30
    return max(1, min(60, n))

Type guard

def is_valid_crawl_timeout(v) -> bool:
    return type(v) is int and 1 <= v <= 60

Try / catch

try:
    querit_contents._invoke(urls=urls, crawl_timeout=t)
except ValueError as e:
    if "crawl_timeout" in str(e):
        t = 30; querit_contents._invoke(urls=urls, crawl_timeout=t)
    raise

Prevention

When it happens

Trigger: crawl_timeout=2.5 (float from a slider/LLM), crawl_timeout="30" (string from a form field), crawl_timeout=True (bool passes isinstance(int) but fails the strict type() check), crawl_timeout=0 or 90 (out of the 1..60 range).

Common situations: UI inputs returning strings; agent parameter interpolation producing '30' instead of 30; users copying a 120-second timeout from another crawler config; JSON configs where the value was written unquoted but as 30.0.

Understand the failure class

Related errors


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