{"record":{"id":"81ee3da73f1bab03","repo":"infiniflow/ragflow","slug":"unsupported-expected-type-expected-type","errorCode":null,"errorMessage":"Unsupported expected type: {expected_type}","messagePattern":"Unsupported expected type: (.+?)","errorType":"validation","errorClass":"ContractError","httpStatus":null,"severity":"error","filePath":"agent/tools/code_exec.py","lineNumber":144,"sourceCode":"\n\ndef _normalize_expected_type(expected_type: str) -> str:\n    etype = expected_type.strip()\n    low = etype.lower()\n    simple_types = {\n        \"string\": \"String\",\n        \"number\": \"Number\",\n        \"boolean\": \"Boolean\",\n        \"object\": \"Object\",\n        \"null\": \"Null\",\n        \"any\": \"Any\",\n    }\n    if low in simple_types:\n        return simple_types[low]\n    if low.startswith(\"array<\") and low.endswith(\">\"):\n        inner = etype[etype.find(\"<\") + 1 : -1].strip()\n        if not inner:\n            raise ContractError(f\"Unsupported expected type: {expected_type}\")\n        return f\"Array<{_normalize_expected_type(inner)}>\"\n    return etype\n\n\ndef _validate_expected_type(expected_type: str, value, path: str = \"\") -> None:\n    etype = _normalize_expected_type(expected_type)\n    if not etype or etype.lower() == \"any\":\n        return\n\n    value = normalize_output_value(value)\n\n    if etype.startswith(\"Array<\") and etype.endswith(\">\"):\n        inner_type = etype[6:-1].strip()\n        if not isinstance(value, list):\n            raise ContractError(f\"CodeExec contract mismatch at {path or 'value'}: expected type {etype}, got {infer_actual_type(value)}\")\n        for index, item in enumerate(value):\n            child_path = f\"{path}[{index}]\" if path else f\"[{index}]\"\n            _validate_expected_type(inner_type, item, child_path)","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/agent/tools/code_exec.py#L126-L162","documentation":"Error \"Unsupported expected type: {expected_type}\" thrown in infiniflow/ragflow.","triggerScenarios":"Thrown at agent/tools/code_exec.py:144 when the library encounters an invalid state.","commonSituations":"The CodeExec contract specifies a type outside the supported set (e.g. a typo or a language-specific type); using a supported type name prevents this error.","solutions":["Use one of the supported expected types in the CodeExec contract.","Check the contract schema for the list of allowed type names."],"exampleFix":"outputs = [{'name': 'result', 'type': 'Array'}]  # supported type","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}