docling-project/docling · error · SystemExit

Input directory does not exist: {input_dir}

Error message

Input directory does not exist: {input_dir}

What it means

SystemExit raised by main() in perfs/iterate_pdf_pages.py when the resolved input directory does not exist on disk. After input resolution (local --input-dir or a downloaded HF snapshot), the script verifies the path with Path.is_dir() before globbing for PDFs, failing fast when the benchmark corpus location is wrong.

Source

Thrown at perfs/iterate_pdf_pages.py:815

                    pdf_path.name,
                    failed_pages,
                    num_pages,
                )
        return processed_pages, failed_pages
    finally:
        doc_backend.unload()


def main() -> None:
    logging.basicConfig(
        level=logging.INFO,
        format="%(message)s",
    )
    args = parse_args()
    input_dir = _resolve_input_dir(args)

    if not input_dir.is_dir():
        raise SystemExit(f"Input directory does not exist: {input_dir}")

    if args.output_dir is not None:
        args.output_dir.mkdir(parents=True, exist_ok=True)

    report_file = args.report_file or _default_report_file(args.mode)

    pdfs = sorted(input_dir.glob(args.glob))
    if not pdfs:
        _log.warning("No files matched '%s' in %s", args.glob, input_dir)
        return

    _log.info("Found %d PDF file(s) in %s", len(pdfs), input_dir)
    _log.info("Running in %s mode", args.mode)

    if args.no_cache:
        cache_file: Path | None = None
    else:
        cache_file = (

View on GitHub (pinned to 61d76f1ff3)

Solutions

  1. Verify the path exists and is a directory: 'ls <input_dir>' before launching the benchmark.
  2. Use absolute paths (or resolve relative to the script: Path(__file__).parent / ...) so cwd changes cannot break it.
  3. If the corpus lives on a mount, ensure the mount is active before the run (check with 'mount | grep <path>' or re-run the mount step).

Example fix

# before
$ python perfs/iterate_pdf_pages.py --input-dir ./pdfs   # run from wrong cwd

# after
$ python perfs/iterate_pdf_pages.py --input-dir "$(pwd)/pdfs"
# or ensure the directory exists first:
$ test -d ./pdfs || { echo 'missing corpus dir'; exit 1; }
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path

input_dir = Path(args.input_dir).expanduser().resolve()
if not input_dir.is_dir():
    raise SystemExit(f"corpus directory missing: {input_dir}")

Prevention

When it happens

Trigger: Running iterate_pdf_pages.py --input-dir /nonexistent/path, or with a relative path resolved from a different working directory, or when an env-var-driven corpus path points at a mount that is not mounted.

Common situations: Typos or stale paths in benchmark scripts; relative paths broken by running from another cwd; network mounts/NFS shares not yet mounted in containers or CI runners; dataset snapshots deleted by cache cleanup between runs.

Related errors


AI-assisted analysis of docling-project/docling@61d76f1ff3 (2026-08-14). Data as JSON: /api/errors/d9333adf751eccd0. Report an issue: GitHub.