MadsLorentzen/ai-job-search · error · VerificationError
PDF does not exist: {pdf_path}
Error message
PDF does not exist: {pdf_path} What it means
verify_pdf() raises this when the path argument does not point to an existing regular file. It is an explicit precondition check performed before any text extraction is attempted, so no poppler tools are invoked for a missing file.
Source
Thrown at tools/verify_pdf.py:93
# even when the caller did not request --pages (same Poppler package).
pages = parse_page_count(run_tool(["pdfinfo", str(pdf_path)]))
return text, pages
def extract_text_layer(pdf_path):
"""Extract ATS-readable text. Returns (text, pages, extractor_name)."""
pypdf_result = _extract_pypdf(pdf_path)
if pypdf_result is not None:
text, pages = pypdf_result
return text, pages, "pypdf"
text, pages = _extract_pdftotext(pdf_path)
return text, pages, "pdftotext"
def verify_pdf(pdf_path, expected_pages=None, min_chars=1, required_text=(), dump_text=None):
pdf_path = Path(pdf_path)
if not pdf_path.is_file():
raise VerificationError(f"PDF does not exist: {pdf_path}")
extracted_text, actual_pages, extractor = extract_text_layer(pdf_path)
# Write dump *before* the checks so a failed verification still leaves a .txt
if dump_text is not None:
dump_path = Path(dump_text)
try:
dump_path.parent.mkdir(parents=True, exist_ok=True)
dump_path.write_text(
extracted_text if extracted_text.endswith("\n") else extracted_text + "\n",
encoding="utf-8",
)
except OSError as exc:
raise VerificationError(
f"could not write --dump-text to {dump_path}: {exc}"
) from exc
if expected_pages is not None and actual_pages != expected_pages:View on GitHub (pinned to 79cd383e58)
Solutions
- Confirm the path exists and is a file: `ls -l <path>` or Path(pdf_path).is_file() before calling
- If generated programmatically, check the generation step's exit code/output before verifying
- Use absolute paths (e.g. Path.cwd() / relative) to avoid working-directory mismatches
- If the file is produced asynchronously, wait/retry until it appears
Example fix
// before
verify_pdf('out/report.pdf')
// after
pdf = Path('out/report.pdf').resolve()
if not pdf.is_file():
raise SystemExit(f'missing artifact: {pdf}')
verify_pdf(pdf) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
p = Path(pdf_path).resolve()
if not p.is_file():
raise SystemExit(f'PDF artifact missing: {p}')
verify_pdf(p) Try / catch
try:
verify_pdf(pdf_path)
except VerificationError as e:
if 'does not exist' in str(e):
# regenerate or locate the artifact
... Prevention
- Resolve paths to absolute before verification to avoid cwd drift
- Verify artifact-producing steps succeeded before verifying artifacts
- Add a pipeline step that fails fast if expected outputs are absent
When it happens
Trigger: Calling verify_pdf('/path/to/missing.pdf') where the path is a typo, a directory, a URL, or the file was deleted/moved before verification. Also triggered when a build pipeline passes an output path that a previous PDF-generation step failed to produce.
Common situations: CI job verifying a PDF artifact before the generating step ran or after it failed silently; relative paths resolved against a different working directory; passing a Path versus str mismatch that points elsewhere; file not yet flushed/closed by the producer.
Related errors
- pdfinfo output did not contain a page count
- expected {expected_pages} page(s), found {actual_pages} (ext
- text layer has {len(normalized)} character(s); expected at l
- text layer is missing required text: {required!r} (extractor
- could not write --dump-text to {dump_path}: {exc}
AI-assisted analysis of MadsLorentzen/ai-job-search@79cd383e58 (2026-08-27).
Data as JSON: /api/errors/7c0a054a508b2fe7.
Report an issue: GitHub.