ScrapeGraphAI/Scrapegraph-ai · error · TimeoutError

PDF parsing exceeded timeout of {self.timeout} seconds

Error message

PDF parsing exceeded timeout of {self.timeout} seconds

What it means

FetchNode.load_file_content runs PDF loading in a single-thread ThreadPoolExecutor and waits with self.timeout seconds; if the loader does not finish in time, future.result raises TimeoutError which is re-raised as this TimeoutError with the configured limit.

Source

Thrown at scrapegraphai/nodes/fetch_node.py:196

        Returns:
        list: A list containing a Document object with the loaded content and metadata.
        """

        if input_type == "pdf":
            from langchain_community.document_loaders import PyPDFLoader
            loader = PyPDFLoader(source)
            # PyPDFLoader.load() can be blocking for large PDFs. Run it in a thread and
            # enforce the configured timeout if provided.
            if self.timeout is None:
                return loader.load()
            else:
                with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor:
                    future = executor.submit(loader.load)
                    try:
                        return future.result(timeout=self.timeout)
                    except concurrent.futures.TimeoutError:
                        raise TimeoutError(
                            f"PDF parsing exceeded timeout of {self.timeout} seconds"
                        )
        elif input_type == "csv":
            try:
                import pandas as pd
            except ImportError:
                raise ImportError(
                    "pandas is not installed. Please install it using `pip install pandas`."
                )
            return [
                Document(
                    page_content=str(pd.read_csv(source)), metadata={"source": "csv"}
                )
            ]
        elif input_type == "json":
            with open(source, encoding="utf-8") as f:
                return [
                    Document(

View on GitHub (pinned to 532dfffbf6)

Solutions

  1. Increase the timeout in the fetch node config, e.g. node_config={'fetch': {'timeout': 120}} or graph_config['fetch']['timeout']
  2. Pre-process large PDFs (split pages) before feeding them to the graph
  3. If it consistently hangs, verify the PDF is not corrupted (test with pypdf/pdfplumber directly)

Example fix

# before
graph_config = {'fetch': {'timeout': 10}}
# after
graph_config = {'fetch': {'timeout': 120}}
Defensive patterns

Strategy: retry

Validate before calling

import os
size = os.path.getsize(pdf_path)
timeout = max(30, size // 100_000)  # scale timeout with file size

Try / catch

for attempt, timeout in enumerate([30, 90, 300], 1):
    try:
        run_graph(fetch_timeout=timeout)
        break
    except TimeoutError as e:
        if f'exceeded timeout of {timeout}' not in str(e) or attempt == 3:
            raise

Prevention

When it happens

Trigger: Loading a very large or scanned PDF (OCR-heavy) that takes longer than fetch_node's timeout config; a slow/remote filesystem; timeout misconfigured to a small value while the document is hundreds of pages.

Common situations: Default timeout too low for big PDFs; network-mounted PDF sources; corrupted PDFs that hang the parser.

Understand the failure class

Related errors


AI-assisted analysis of ScrapeGraphAI/Scrapegraph-ai@532dfffbf6 (2026-08-28). Data as JSON: /api/errors/541788b702a1ce81. Report an issue: GitHub.