[BUG] Read tool falsely reports unencrypted pandoc/LaTeX PDFs as 'password-protected'
What happened
The built-in Read tool's PDF path returns:
PDF is password-protected. Please provide an unprotected version.
…for PDFs that are not encrypted at all (no /Encrypt dictionary, no user/owner password). This forces the user to "provide an unprotected version" that already exists, or abandon the read — wasting tokens and time on a false premise.
Repro
- Export a PDF via pandoc or pdflatex/LaTeX (these commonly produce PDFs with compressed object streams + cross-reference streams rather than a classic xref table).
Readthe.pdf.- Observe the false
password-protectederror.
Evidence it is NOT encrypted
Raw byte scan for /Encrypt across the affected files returns nothing (no encrypt dictionary present):
data = open(p, "rb").read()
print("/Encrypt" in data.decode("latin1")) # -> False for every file
And pdftotext -layout file.pdf out.txt (poppler) extracts the full text cleanly with no password. So the documents are plain, unencrypted PDFs.
Expected
- The Read PDF parser should not report
password-protectedunless an/Encryptdictionary actually requires a password. - For PDFs it cannot parse (object streams / xref streams), it should emit an accurate error (e.g. "could not parse PDF structure") and/or fall back to
pdftotext/poppler — not blame encryption.
Impact
This is not a one-off. Every pandoc/LaTeX-exported PDF the user reads hits this. The misleading error sends both the user and the agent down a dead-end ("set a password? remove a password that was never set?"). Misdiagnosis = repeated wasted turns.
Workaround (works reliably)
pdftotext -layout "<input.pdf>" out.txt
then read out.txt. Poppler handles these PDFs fine, confirming the files are valid and unencrypted.
Environment
- Claude Code on Windows
- PDFs produced by pandoc / pdflatex (TeX Live 2024)
- poppler
pdftotextavailable and succeeds on the same files
Showing cached comments. Read the full discussion on GitHub ↗
5 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
looks like a feature if still not closed. Keep duplicate - force resolving.
Also reproduces with Edge/Chromium
--print-to-pdfoutput (PDF 1.4) on Windows — not specific to pandoc/LaTeX.Minimal repro (any Windows 11 box, no TeX needed):
Readonout.pdf->PDF is password-protected. Please provide an unprotected version.Verified unencrypted: a raw byte scan finds no
/Encryptdictionary. PyMuPDF opens it without any password and extracts the full text:So in addition to poppler, PyMuPDF works as a fallback — supporting the diagnosis that the Read tool's parser is misclassifying valid unencrypted PDFs (likely the xref/object-stream variants Chromium also emits) as encrypted. I'm hitting this across multiple sessions and unrelated PDFs.
Based on my investigation, this issue can be resolved by downloading the latest release of
poppler-windowsand adding theLibrary\binfolder toPATH.The detailed reason is as follows:
Readtool reads a PDF, it calls thepdftoppmcommand to convert the PDF into JPEG images.pdftoppmcommand.ENABLE_LIBJPEGcompile option enabled. As a result, the bundledpdftoppmcommand does not support the-jpegparameter.Readtool, the error output dumps all relevant parameters and their corresponding descriptions at once. Among them, the descriptions of-opwand-upwcontain the wordpassword.password-protectederror as long asstderrcontains the wordpassword.Thanks @CrossStar — your analysis was spot on and pointed me in the right direction.
One caveat for others trying this: installing poppler via winget (
oschwartz10612.Poppler) does not work if you launch Claude Code from your home directory. Claude Code's internal command resolution rejects any executable located under the current working directory as unsafe, and when cwd isC:\Users\<you>, that includes the winget install location underAppData\Local\Microsoft\WinGet\Packages\.... The TeX Livepdftoppmthen gets picked up instead (or resolution fails entirely), and the bug persists.What worked for me: copy the poppler release to a directory outside your user profile (e.g.
C:\poppler) and putC:\poppler\Library\binonPATHahead of the TeX Live entries. A symlink/junction into AppData does not work — the safety check resolves links — it has to be a real copy.