{"record":{"id":"b1aa0be5b6c79f82","repo":"binary-husky/gpt_academic","slug":"reached-the-limit-of-doc2x-trace-id-trace-id","errorCode":null,"errorMessage":"Reached the limit of Doc2x:\nTrace ID: {trace_id} {uid}\n{code} - {meg}","messagePattern":"Reached the limit of Doc2x:\nTrace ID: (.+?) (.+?)\n(.+?) - (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"crazy_functions/pdf_fns/parse_pdf_via_doc2x.py","lineNumber":65,"sourceCode":"\n\ndef doc2x_api_response_status(response, uid=\"\"):\n    \"\"\"\n    Check the status of Doc2x API response\n    Args:\n        response_data: Response object from Doc2x API\n    \"\"\"\n    response_json = response.json()\n    response_data = response_json.get(\"data\", {})\n    code = response_json.get(\"code\", \"Unknown\")\n    meg = response_data.get(\"message\", response_json)\n    trace_id = response.headers.get(\"trace-id\", \"Failed to get trace-id\")\n    if response.status_code != 200:\n        raise RuntimeError(\n            f\"Doc2x return an error:\\nTrace ID: {trace_id} {uid}\\n{response.status_code} - {response_json}\"\n        )\n    if code in [\"parse_page_limit_exceeded\", \"parse_concurrency_limit\"]:\n        raise RuntimeError(\n            f\"Reached the limit of Doc2x:\\nTrace ID: {trace_id} {uid}\\n{code} - {meg}\"\n        )\n    if code not in [\"ok\", \"success\"]:\n        raise RuntimeError(\n            f\"Doc2x return an error:\\nTrace ID: {trace_id} {uid}\\n{code} - {meg}\"\n        )\n    return response_data\n\n\ndef 解析PDF_DOC2X_转Latex(pdf_file_path):\n    zip_file_path, unzipped_folder = 解析PDF_DOC2X(pdf_file_path, format=\"tex\")\n    return unzipped_folder\n\n\ndef 解析PDF_DOC2X(pdf_file_path, format=\"tex\"):\n    \"\"\"\n    format: 'tex', 'md', 'docx'\n    \"\"\"","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/binary-husky/gpt_academic/blob/d6bde0fa54373309bd05823a49bda8da019d2c77/crazy_functions/pdf_fns/parse_pdf_via_doc2x.py#L47-L83","documentation":"Doc2x returned HTTP 200 but the response body's code field is one of parse_page_limit_exceeded or parse_concurrency_limit — the account hit its page quota for this parse or has too many concurrent parse jobs. The message carries trace-id, uid, the code, and the server's message field.","triggerScenarios":"Uploading PDFs whose page count exceeds the account's remaining page quota; running several Doc2x parses simultaneously beyond the concurrency allowance.","commonSituations":"Batch-processing many PDFs in one go; shared team key hitting limits; large documents (hundreds of pages) on a free/trial tier.","solutions":["Wait for in-flight parses to finish and retry sequentially (concurrency limit)","Check the Doc2x console for remaining page quota; upgrade the plan or top up pages","Split large PDFs into smaller chunks and process them over time","Note the trace-id for disputing miscounted pages with support"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"def can_parse_now(pages: int) -> bool:\n    return concurrent_parses == 0 and pages <= remaining_page_quota()","typeGuard":null,"tryCatchPattern":"try:\n    upload_and_parse(pdf)\nexcept RuntimeError as e:\n    if 'parse_concurrency_limit' in str(e):\n        time.sleep(30); upload_and_parse(pdf)  # serialize and retry\n    elif 'parse_page_limit_exceeded' in str(e):\n        raise RuntimeError('Doc2x page quota exhausted — top up or split the PDF') from e\n    raise","preventionTips":["Process Doc2x parses sequentially, never in parallel threads","Track page counts against the account quota before large jobs","Split huge PDFs (e.g. >200 pages) into parts"],"tags":["doc2x","rate-limit","quota","api","external-service"],"backgroundTag":null,"analyzedSha":"d6bde0fa54373309bd05823a49bda8da019d2c77","analyzedAt":"2026-08-14T22:48:35.038Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}