PDF file swap during chrome-paper-downloader batch download

Resolved 💬 3 comments Opened Mar 8, 2026 by aeghnnsw Closed Mar 11, 2026

Problem

When chrome-paper-downloader agents download multiple papers in a batch, some PDFs get written to the wrong filenames. The file content is swapped between papers.

Observed behavior

In a batch download session downloading ~20 papers for immunometabolism research questions (Q565, Q566, Q567), several papers had their PDF files swapped:

  • Paper 896 ↔ 897: file_paths pointed to each other's content
  • Paper 902 ↔ 903: file_paths pointed to each other's content
  • Paper 907 ↔ 908: file_paths pointed to each other's content
  • Papers 899, 900: PDFs contained completely unrelated papers (not matching any other paper in the batch)

Impact

  • Evidence extracted from mismatched PDFs gets attributed to the wrong paper in the evidence database
  • Compiled answers cite wrong papers for their findings
  • 8 out of ~20 papers (40%) in one batch had wrong PDFs
  • File hashes in the DB match the wrong files (the incorrect content was stored at download time)

Detection

Reader agents detected the mismatches by checking PDF title/DOI against the database record. Some agents extracted evidence from the actual content anyway (with a mismatch warning), others refused to extract.

Fix applied

  • Swapped file_path values in the paper database for the 3 confirmed swap pairs
  • Deleted all evidence entries extracted from wrong PDFs
  • Re-read papers with corrected file_paths
  • Papers 899, 900 still need manual PDF replacement (content doesn't match any other paper in DB)

Possible cause

The chrome-paper-downloader agents run in parallel (up to 3 concurrent). The file swap pattern suggests a race condition where:

  1. Multiple downloaders save PDFs to the Chrome Downloads folder simultaneously
  2. The file detection/rename logic picks up the wrong file for the wrong paper
  3. The file_hash is computed after the swap, so it matches the (wrong) stored file

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗