{"record":{"id":"045c5185ef993a4f","repo":"open-webui/open-webui","slug":"error-calling-mineru-local-api-str-e","errorCode":null,"errorMessage":"Error calling MinerU Local API: {str(e)}","messagePattern":"Error calling MinerU Local API: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"critical","filePath":"backend/open_webui/retrieval/loaders/mineru.py","lineNumber":128,"sourceCode":"\n        except FileNotFoundError:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, detail=f'File not found: {self.file_path}')\n        except requests.Timeout:\n            raise HTTPException(\n                status.HTTP_504_GATEWAY_TIMEOUT,\n                detail='MinerU Local API request timed out',\n            )\n        except requests.HTTPError as e:\n            error_detail = f'MinerU Local API request failed: {e}'\n            if e.response is not None:\n                try:\n                    error_data = e.response.json()\n                    error_detail += f' - {error_data}'\n                except Exception:\n                    error_detail += f' - {e.response.text}'\n            raise HTTPException(status.HTTP_400_BAD_REQUEST, detail=error_detail)\n        except Exception as e:\n            raise HTTPException(\n                status.HTTP_500_INTERNAL_SERVER_ERROR,\n                detail=f'Error calling MinerU Local API: {str(e)}',\n            )\n\n        # 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\",","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/open-webui/open-webui/blob/01f4282f1ffe0d6212f58d3afbeae21fffd0c4be/backend/open_webui/retrieval/loaders/mineru.py#L110-L146","documentation":"Catch-all HTTP 500 for any non-HTTPError, non-Timeout exception while calling the Local API. Most often this is requests.ConnectionError (service unreachable, DNS failure, refused connection) because the loader has no dedicated except clause for it, so connection problems surface as a generic 500.","triggerScenarios":"MinerU container/process not running; wrong api_url host or port (default http://localhost:8000); DNS resolution failure for a remote MinerU host; TLS certificate error on an https api_url.","commonSituations":"Docker networking mismatch (container localhost vs host gateway); MinerU crashed from OOM during a previous parse; api_url typo or stale port after redeploying the service; firewall blocking egress to a remote MinerU instance.","solutions":["Confirm the service is up: curl {api_url}/docs or the health endpoint from the same host/network namespace","Fix api_url to the actually reachable address (e.g. http://host.docker.internal:8000 or the service name in docker-compose)","Check MinerU container logs for a crash/OOM and restart it","If remote, verify DNS resolution and firewall rules on the port","Add a preflight connectivity check before invoking load() (see defense)"],"exampleFix":"// before\nloader = MinerULoader(file_path=p, api_mode='local', api_url='http://localhost:8000')\n\n// after\n# from inside another container, reach the service by name\nloader = MinerULoader(file_path=p, api_mode='local', api_url='http://mineru:8000')","handlingStrategy":"validation","validationCode":"import requests, socket\nsocket.gethostbyname(urlparse(api_url).hostname)  # fails fast on DNS\nr = requests.get(f'{api_url}/docs', timeout=5)\nassert r.status_code == 200, f'MinerU Local API not reachable at {api_url}'","typeGuard":null,"tryCatchPattern":"try:\n    docs = loader.load()\nexcept HTTPException as e:\n    if e.status_code == 500 and 'Error calling MinerU Local API' in e.detail:\n        # detail will contain 'ConnectionError' when the service is down\n        raise RuntimeError(f'MinerU unreachable: {e.detail}') from e\n    raise","preventionTips":["Add a health check on the MinerU service to your orchestrator","Use service names (docker-compose DNS) instead of localhost across containers","Alert on MinerU container restarts/OOM kills","Run the connectivity preflight above before batch ingestion jobs"],"tags":["mineru","local-api","connection-error","network","deployment"],"backgroundTag":null,"analyzedSha":"01f4282f1ffe0d6212f58d3afbeae21fffd0c4be","analyzedAt":"2026-08-14T18:25:22.715Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}