infiniflow/ragflow · error · ValueError
Querit format must be text, markdown, or html.
Error message
Querit format must be text, markdown, or html.
What it means
ValueError from _validate_contents_inputs(): the 'format' parameter of the Querit contents tool must be one of QUERIT_CONTENT_FORMATS — text, markdown, or html (case-sensitive). Any other string, None, or non-string type raises.
Source
Thrown at agent/tools/querit.py:380
"extrasMeta": extras_meta,
}
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,View on GitHub (pinned to 554fb1133a)
Solutions
- Use exactly one of: 'text', 'markdown', 'html'.
- Map common aliases in your caller: {'md': 'markdown', 'plain': 'text', 'htm': 'html'}.
- Lowercase the value before passing it in.
- Ensure the parameter is always provided — there is no default inside the validator.
Example fix
# before
format = "md" # ValueError
# after
aliases = {"md": "markdown", "plain": "text", "htm": "html"}
format = aliases.get(user_format.lower(), user_format.lower()) # -> "markdown" Defensive patterns
Strategy: validation
Validate before calling
QUERIT_FORMATS = {"text", "markdown", "html"}
def safe_querit_format(v) -> str:
v = str(v or "text").strip().lower()
return v if v in QUERIT_FORMATS else "text" Type guard
def is_querit_format(v) -> bool:
return v in {"text", "markdown", "html"} Try / catch
try:
querit_contents._invoke(urls=urls, format=fmt)
except ValueError as e:
if "format" in str(e):
fmt = "markdown"; querit_contents._invoke(urls=urls, format=fmt)
raise Prevention
- Constrain the format field in UIs to a dropdown of the three exact values.
- Lowercase and alias-map ('md'->'markdown') user input before invoking.
- Always pass format explicitly; the validator has no default.
When it happens
Trigger: Calling contents with format='md' or 'MD' (unrecognized abbreviation/case), format=None because the workflow omitted an optional-looking field, or a numeric/bool value bound from an upstream component output.
Common situations: Users assuming 'md' is accepted for markdown; canvas UI passing an empty string when the field is cleared; LLM-generated parameters using 'plain' or 'raw' instead of 'text'.
Related errors
- Querit urls must contain between 1 and 10 non-empty strings.
- Querit urls must be absolute HTTP or HTTPS URLs.
- Querit crawl_timeout must be an integer from 1 to 60.
- Querit extras_meta must be a boolean.
- Querit count must be an integer greater than or equal to 1.
AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15).
Data as JSON: /api/errors/cee60e5922540c63.
Report an issue: GitHub.