{"record":{"id":"24062e7fc8551d0f","repo":"infiniflow/ragflow","slug":"querit-api-response-field-statuses-must-be-an-arra","errorCode":null,"errorMessage":"Querit API response field statuses must be an array.","messagePattern":"Querit API response field statuses must be an array\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"agent/tools/querit.py","lineNumber":393,"sourceCode":"    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,\n    time_range: Any,\n    site_include: Any,\n    site_exclude: Any,\n    country_include: Any,\n    language_include: Any,\n) -> None:\n    if type(count) is not int or count < 1:\n        raise ValueError(\"Querit count must be an integer greater than or equal to 1.\")\n    if chunks_per_doc is not None and (type(chunks_per_doc) is not int or not 1 <= chunks_per_doc <= 3):\n        raise ValueError(\"Querit chunks_per_doc must be an integer from 1 to 3.\")\n    if type(time_range) is not str:\n        raise ValueError(\"Querit time_range must be a string.\")\n    if time_range and not TIME_RANGE_PATTERN.fullmatch(time_range):","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/tools/querit.py#L375-L411","documentation":"TypeError from _validate_contents_response(): when the response object contains a 'statuses' key (per-URL crawl statuses), its value must be an array. Like 'results', the key is optional but type-checked when present.","triggerScenarios":"A contents response with {\"statuses\": {\"0\": \"ok\"}} (object keyed by index) or {\"statuses\": \"ok\"} instead of the expected per-URL array.","commonSituations":"API schema drift converting the statuses array to a map; partial responses where statuses is a sentinel string; contract tests with loose typing.","solutions":["Confirm via curl that statuses is an array aligned with the request urls order.","Report/pin the API contract — object-shaped statuses are a breaking change for this client.","Adapt in a wrapper if you control the server: emit [] not null/''.","Update mocks."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"def contents_statuses_ok(data: dict) -> bool:\n    return \"statuses\" not in data or isinstance(data[\"statuses\"], list)","typeGuard":"from typing import Any\ndef has_list_statuses(v: Any) -> bool:\n    return not isinstance(v, dict) or \"statuses\" not in v or isinstance(v[\"statuses\"], list)","tryCatchPattern":"try:\n    querit_contents._invoke(urls=urls)\nexcept TypeError as e:\n    if \"statuses must be an array\" in str(e):\n        alert_api_contract_drift(e)\n    raise","preventionTips":["Validate per-URL statuses arrays align with request order before consuming them.","Log raw payloads on shape violations to diagnose upstream drift fast."],"tags":["api","json","response-validation","querit"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}