{"record":{"id":"2157db3a3380a7a6","repo":"HKUDS/DeepTutor","slug":"mineru-parsing-timed-out-after-int-timeout-s-la","errorCode":null,"errorMessage":"MinerU parsing timed out after {int(timeout)}s (last state: {last_state or 'unknown'}).","messagePattern":"MinerU parsing timed out after (.+?)s \\(last state: (.+?)\\)\\.","errorType":"exception","errorClass":"MinerUError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/parsing/engines/mineru/cloud.py","lineNumber":201,"sourceCode":"                report = f\"MinerU cloud: {state or 'queued'}\"\n                if total_pages:\n                    report += f\" ({progress.get('extracted_pages') or 0}/{total_pages} pages)\"\n                if report != last_report:\n                    last_report = report\n                    try:\n                        on_progress(report)\n                    except Exception:\n                        on_progress = None\n            if state == _TERMINAL_OK:\n                zip_url = str(entry.get(\"full_zip_url\") or \"\").strip()\n                if not zip_url:\n                    raise MinerUError(\"MinerU reported done but returned no full_zip_url.\")\n                return zip_url\n            if state == _TERMINAL_FAIL:\n                err = str(entry.get(\"err_msg\") or \"unknown error\")\n                raise MinerUError(f\"MinerU failed to parse the document: {err}\")\n        if time.monotonic() >= deadline:\n            raise MinerUError(\n                f\"MinerU parsing timed out after {int(timeout)}s \"\n                f\"(last state: {last_state or 'unknown'}).\"\n            )\n        time.sleep(poll_interval)\n\n\ndef verify_credentials(config: MinerUConfig) -> None:\n    \"\"\"Best-effort connectivity / token check for the Settings → MinerU \"Test\"\n    button. Requests an upload slot (which does not consume parsing quota and\n    is never followed by an upload, so it simply expires) and validates the\n    business code. Raises :class:`MinerUError` with a user-facing message on\n    any failure.\"\"\"\n    if not config.api_keys:\n        raise MinerUError(\"No API token configured.\")\n    base_url = config.api_base_url.rstrip(\"/\")\n    key_pool = KeyPool(config.api_keys)\n    body: dict[str, object] = {\n        \"files\": [{\"name\": \"connectivity-check.pdf\", \"is_ocr\": False}],","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/parsing/engines/mineru/cloud.py#L183-L219","documentation":"The cloud job did not reach a terminal state before the monotonic deadline (timeout seconds). The last observed state is included for diagnosis.","triggerScenarios":"Polling until time.monotonic() >= deadline — slow MinerU queue, very large PDFs, or a low configured timeout.","commonSituations":"Batch-hour congestion, 500+ page documents, aggressive timeout values, or a stuck 'running' state server-side.","solutions":["Increase the timeout passed to parse_cloud for large documents.","Retry — jobs often finish on a second submission.","Reduce PDF size (split pages) if consistently timing out.","Check the last_state value: 'waiting/running' means slow; unknown means polling itself may be failing."],"exampleFix":"# before\nparse_cloud(pdf, wd, cfg, timeout=300)\n\n# after\nparse_cloud(pdf, wd, cfg, timeout=1800)  # large PDFs","handlingStrategy":"retry","validationCode":"timeout = max(600, pages * 8)  # scale with document size","typeGuard":null,"tryCatchPattern":"try:\n    parse_cloud(pdf, wd, cfg, timeout=1800)\nexcept MinerUError as e:\n    if \"timed out\" in str(e):\n        queue_retry(pdf)  # job may still complete server-side","preventionTips":["Scale timeout with page count.","Avoid submitting huge PDFs at peak hours.","Retry timed-out jobs rather than doubling timeout immediately."],"tags":["mineru","cloud","timeout"],"backgroundTag":"remote-job-timeout","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}