{"record":{"id":"212a3e68c23823c4","repo":"open-webui/open-webui","slug":"mineru-returned-empty-results","errorCode":null,"errorMessage":"MinerU returned empty results","messagePattern":"MinerU returned empty results","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"backend/open_webui/retrieval/loaders/mineru.py","lineNumber":151,"sourceCode":"        # Parse response\n        try:\n            result = response.json()\n        except ValueError as e:\n            raise HTTPException(\n                status.HTTP_502_BAD_GATEWAY,\n                detail=f'Invalid JSON response from MinerU Local API: {e}',\n            )\n\n        # Extract markdown content from response\n        if 'results' not in result:\n            raise HTTPException(\n                status.HTTP_502_BAD_GATEWAY,\n                detail=\"MinerU Local API response missing 'results' field\",\n            )\n\n        results = result['results']\n        if not results:\n            raise HTTPException(\n                status.HTTP_400_BAD_REQUEST,\n                detail='MinerU returned empty results',\n            )\n\n        # Get the first (and typically only) result\n        file_result = list(results.values())[0]\n        markdown_content = file_result.get('md_content', '')\n\n        if not markdown_content:\n            raise HTTPException(\n                status.HTTP_400_BAD_REQUEST,\n                detail='MinerU returned empty markdown content',\n            )\n\n        log.info(f'Successfully parsed document with MinerU Local API: {filename}')\n\n        # Create metadata\n        metadata = {","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/open-webui/open-webui/blob/01f4282f1ffe0d6212f58d3afbeae21fffd0c4be/backend/open_webui/retrieval/loaders/mineru.py#L133-L169","documentation":"Raised as HTTP 400 when the Local API returns a 'results' object that is empty ({}). The service completed with 200 but produced zero per-file entries - i.e. the uploaded file produced no parse result at all, usually because the multipart filename key did not match or parsing silently yielded nothing.","triggerScenarios":"The 'files' multipart part name/filename mismatch so MinerU indexes nothing under that name; a corrupt or zero-byte uploaded file that MinerU skips; server-side filtering (e.g. unsupported extension) returning an empty map.","commonSituations":"Zero-byte or truncated file at file_path (interrupted upload to the server); a file type the MinerU build does not register; disk issues making the read return nothing.","solutions":["Check the file is non-empty and a supported type (PDF/Office/images) before parsing","Reproduce with curl -F 'files=@doc.pdf' and inspect the results map","Check MinerU server logs for skipped/failed file registration","Re-save or re-export a possibly corrupt source document and retry"],"exampleFix":"// before\nloader = MinerULoader(file_path=p, api_mode='local')\n\n// after\nimport os\nif os.path.getsize(p) == 0:\n    raise ValueError(f'{p} is empty')\nloader = MinerULoader(file_path=p, api_mode='local')","handlingStrategy":"validation","validationCode":"import os\nassert os.path.exists(path) and os.path.getsize(path) > 0, 'empty or missing file'\nassert os.path.splitext(path)[1].lower() in {'.pdf', '.docx', '.pptx', '.png', '.jpg'}, 'unsupported type'","typeGuard":null,"tryCatchPattern":"try:\n    docs = loader.load()\nexcept HTTPException as e:\n    if e.status_code == 400 and 'empty results' in e.detail:\n        log.warning('MinerU produced no result entries for %s', path)\n    raise","preventionTips":["Reject zero-byte uploads at the API boundary before parsing","Maintain a whitelist of supported extensions matching the MinerU build","Curl-reproduce suspect files to distinguish server skips from loader bugs"],"tags":["mineru","local-api","empty-results","document-parsing","validation"],"backgroundTag":null,"analyzedSha":"01f4282f1ffe0d6212f58d3afbeae21fffd0c4be","analyzedAt":"2026-08-14T18:25:22.715Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}