{"record":{"id":"cee60e5922540c63","repo":"infiniflow/ragflow","slug":"querit-format-must-be-text-markdown-or-html","errorCode":null,"errorMessage":"Querit format must be text, markdown, or html.","messagePattern":"Querit format must be text, markdown, or html\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/tools/querit.py","lineNumber":380,"sourceCode":"        \"extrasMeta\": extras_meta,\n    }\n\n\ndef _normalize_contents_urls(urls: Any) -> Any:\n    if isinstance(urls, str):\n        return [url.strip() for url in urls.split(\",\") if url.strip()]\n    return urls\n\n\ndef _validate_contents_inputs(urls: Any, format: Any, crawl_timeout: Any, extras_meta: Any) -> None:\n    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):\n        raise ValueError(\"Querit urls must contain between 1 and 10 non-empty strings.\")\n    for url in urls:\n        parsed = urlparse(url)\n        if parsed.scheme not in {\"http\", \"https\"} or not parsed.netloc:\n            raise ValueError(\"Querit urls must be absolute HTTP or HTTPS URLs.\")\n    if format not in QUERIT_CONTENT_FORMATS:\n        raise ValueError(\"Querit format must be text, markdown, or html.\")\n    if type(crawl_timeout) is not int or not 1 <= crawl_timeout <= 60:\n        raise ValueError(\"Querit crawl_timeout must be an integer from 1 to 60.\")\n    if type(extras_meta) is not bool:\n        raise ValueError(\"Querit extras_meta must be a boolean.\")\n\n\ndef _validate_contents_response(response_data: Any) -> None:\n    if not isinstance(response_data, dict):\n        raise TypeError(\"Querit API response must be a JSON object.\")\n    if \"results\" in response_data and not isinstance(response_data[\"results\"], list):\n        raise TypeError(\"Querit API response field results must be an array.\")\n    if \"statuses\" in response_data and not isinstance(response_data[\"statuses\"], list):\n        raise TypeError(\"Querit API response field statuses must be an array.\")\n\n\ndef _validate_search_inputs(\n    count: Any,\n    chunks_per_doc: Any,","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/tools/querit.py#L362-L398","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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."],"exampleFix":"# before\nformat = \"md\"  # ValueError\n\n# after\naliases = {\"md\": \"markdown\", \"plain\": \"text\", \"htm\": \"html\"}\nformat = aliases.get(user_format.lower(), user_format.lower())  # -> \"markdown\"","handlingStrategy":"validation","validationCode":"QUERIT_FORMATS = {\"text\", \"markdown\", \"html\"}\ndef safe_querit_format(v) -> str:\n    v = str(v or \"text\").strip().lower()\n    return v if v in QUERIT_FORMATS else \"text\"","typeGuard":"def is_querit_format(v) -> bool:\n    return v in {\"text\", \"markdown\", \"html\"}","tryCatchPattern":"try:\n    querit_contents._invoke(urls=urls, format=fmt)\nexcept ValueError as e:\n    if \"format\" in str(e):\n        fmt = \"markdown\"; querit_contents._invoke(urls=urls, format=fmt)\n    raise","preventionTips":["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."],"tags":["validation","input","querit","enum"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}