binary-husky/gpt_academic · error · RuntimeError

Reached the limit of Doc2x: Trace ID: {trace_id} {uid} {code

Error message

Reached the limit of Doc2x:
Trace ID: {trace_id} {uid}
{code} - {meg}

What it means

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.

Source

Thrown at crazy_functions/pdf_fns/parse_pdf_via_doc2x.py:65


def doc2x_api_response_status(response, uid=""):
    """
    Check the status of Doc2x API response
    Args:
        response_data: Response object from Doc2x API
    """
    response_json = response.json()
    response_data = response_json.get("data", {})
    code = response_json.get("code", "Unknown")
    meg = response_data.get("message", response_json)
    trace_id = response.headers.get("trace-id", "Failed to get trace-id")
    if response.status_code != 200:
        raise RuntimeError(
            f"Doc2x return an error:\nTrace ID: {trace_id} {uid}\n{response.status_code} - {response_json}"
        )
    if code in ["parse_page_limit_exceeded", "parse_concurrency_limit"]:
        raise RuntimeError(
            f"Reached the limit of Doc2x:\nTrace ID: {trace_id} {uid}\n{code} - {meg}"
        )
    if code not in ["ok", "success"]:
        raise RuntimeError(
            f"Doc2x return an error:\nTrace ID: {trace_id} {uid}\n{code} - {meg}"
        )
    return response_data


def 解析PDF_DOC2X_转Latex(pdf_file_path):
    zip_file_path, unzipped_folder = 解析PDF_DOC2X(pdf_file_path, format="tex")
    return unzipped_folder


def 解析PDF_DOC2X(pdf_file_path, format="tex"):
    """
    format: 'tex', 'md', 'docx'
    """

View on GitHub (pinned to d6bde0fa54)

Solutions

  1. Wait for in-flight parses to finish and retry sequentially (concurrency limit)
  2. Check the Doc2x console for remaining page quota; upgrade the plan or top up pages
  3. Split large PDFs into smaller chunks and process them over time
  4. Note the trace-id for disputing miscounted pages with support
Defensive patterns

Strategy: retry

Validate before calling

def can_parse_now(pages: int) -> bool:
    return concurrent_parses == 0 and pages <= remaining_page_quota()

Try / catch

try:
    upload_and_parse(pdf)
except RuntimeError as e:
    if 'parse_concurrency_limit' in str(e):
        time.sleep(30); upload_and_parse(pdf)  # serialize and retry
    elif 'parse_page_limit_exceeded' in str(e):
        raise RuntimeError('Doc2x page quota exhausted — top up or split the PDF') from e
    raise

Prevention

When it happens

Trigger: Uploading PDFs whose page count exceeds the account's remaining page quota; running several Doc2x parses simultaneously beyond the concurrency allowance.

Common situations: Batch-processing many PDFs in one go; shared team key hitting limits; large documents (hundreds of pages) on a free/trial tier.

Related errors


AI-assisted analysis of binary-husky/gpt_academic@d6bde0fa54 (2026-08-14). Data as JSON: /api/errors/b1aa0be5b6c79f82. Report an issue: GitHub.