[BUG] bug in Claude Code's PDF parser

Status Closed — not planned
Reported on v2.1.68
Maintainer reply None cached
Activity 11 comments · opened Mar 4, 2026 · closed May 29, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I am asking Claude Code to read some pdf files. Each time I get an error saying that "PDF is password-protected. Please provide an unprotected version." Unfortunately, there is no security on the file. After running some bash command, Claude says "Good news — the file has no /Encrypt dictionary, so it's genuinely not password-protected. This appears to be a bug in Claude Code's PDF parser incorrectly flagging the file." (confirmed by command line search).

The same PDF file opens fine in Claude.ai (web)

I am using Windows 11 and I'm running Claude in visual studio.

What Should Happen?

Claude should be able to read the file easily.

Error Messages/Logs

Steps to Reproduce

I simply ask Claude if it can read the file and it says "The PDF is password-protected, so I can't read it."

I have attached screenshots of the messages from Claude below.

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.68

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

<img width="795" height="889" alt="Image" src="https://github.com/user-attachments/assets/1d07821d-a4c3-4b3d-94c2-b80fde0768d8" />
<img width="809" height="817" alt="Image" src="https://github.com/user-attachments/assets/d7787678-1d91-44ac-af3c-48fb72016967" />

View original on GitHub ↗

10 Comments

Tpike2020 · 5 months ago

The "workarounds" don't work either -- the file has a lot of equations, figures and tables so converting to text doesn't help.

asungod · 5 months ago

Bro, have you deal with it?
I also meet this problem

Tpike2020 · 5 months ago

I don't have a solution yet. It might be a problem with Visual Studio or perhaps the interface between Visual Studio and Claude?

asungod · 5 months ago

Thanks, I used claude code in cmd rather than Visual Studio, maybe its the problem of Claude.....
I tried to use python to make my pdf to png which is feasible.

dkrisman · 5 months ago

Reproduction file:

acme-manual.pdf

Reproduction prompt:

can you read and summarize acme-manual.pdf

PDF metadata (from pdfinfo):

Title: ACME User Manual
Author: ACME, Inc.
Creator: LaTeX with hyperref
Producer: LuaTeX-1.17.0
Pages: 14
Encrypted: no
File size: 72738 bytes
PDF version: 1.5

Claude Version:

VSCode extension anthropic.claude-code-2.1.71-win32-x64

Observed behavior:

Claude Code's Read tool returns the following error when attempting to read this PDF:

PDF is password-protected. Please provide an unprotected version.

More details:
Call Read with pages: "1-5" → error: "PDF is password-protected"
Call Read without pages parameter → correctly returns metadata including page count
Key observations:

Omitting pages works (partially — returns metadata, reports correct page count of 14)
Adding any pages range triggers the false encryption error
PDF was also tested as: qpdf --decrypt rewrite, linearized, and downgraded to PDF 1.4 — all fail identically
pdfinfo confirms: Encrypted: no, Producer: LuaTeX-1.17.0, PDF version 1.5
The error message is misleading — the actual issue appears to be in the page range extraction/splitting code path, not encryption detection

Expected behavior:

The PDF should be read normally — pdfinfo confirms Encrypted: no. The file is not password-protected.

Meme-Theory · 5 months ago

The bug is simpler and worse than the GitHub issues describe. The issue reports blame PDF permission flags (/Encrypt
dictionary, "do not print" restrictions). Our testing proved that's wrong — the pages parameter fails on every PDF on
Windows, including clean arXiv papers with zero encryption. The error message "password-protected" is a red herring
from a completely broken page-splitting code path.

The fix is a page extractor, not a permission stripper. pdf-extract-pages.py creates a new small PDF with just the
pages you need. The Read tool happily reads small PDFs without the pages parameter. The workflow becomes:

  1. python pdf-extract-pages.py paper.pdf "1-5" → produces paper_p1-5.pdf
  2. Read(file_path="paper_p1-5.pdf") → works perfectly

Why the GitHub reporters got confused: Some PDFs with permission flags fail even without pages (the Read tool checks
encryption before page splitting). But the pages code path has its own independent bug that kills ALL PDFs. Two
separate bugs, same misleading error message.

Workaround: PreToolUse hook + page extraction script (Windows)

We built a three-piece workaround for this bug on Windows 11:

  1. Python page extractor (pdf-extract-pages.py) — Uses PyMuPDF to create a fresh PDF with only the requested pages via

insert_pdf() into a new empty document. Supports single ranges ("15-25") and batch mode (--batch) which splits the
entire PDF into 10-page chunks. The new PDFs have no /Encrypt dictionary and read fine without the pages parameter.

  1. PreToolUse hook on the Read tool — A bash script that intercepts every Read call targeting a .pdf file. If the

pages parameter is present, it blocks with exit code 2 (the code path is broken regardless of file). If pages is
absent but the PDF has >10 pages, it also blocks (Read silently rejects PDFs with 11+ pages even without pages). Small
PDFs pass through.

  1. /pdf skill — A slash command that automates the split-read-synthesize workflow: runs the extractor in batch mode,

reads each chunk sequentially without pages, synthesizes against the user's prompt, then cleans up.

Key finding from testing: The bug is NOT about PDF permissions or /Encrypt dictionaries. We created a completely clean
PDF (no encryption, permissions=-4, verified via PyMuPDF) and it still fails when pages is specified. We also
confirmed that the same arXiv PDF that fails with pages="1-5" reads perfectly without the pages parameter. The pages
code path is independently broken on Windows — the "password-protected" error message is misleading.

Additional finding: The Read tool's actual page limit without pages is 10, not 20 as stated in the error message. PDFs
with 11+ pages are rejected as "too many to read at once."

dkrisman · 4 months ago

this is not stale, my simple reproduction case still gives the same "password-protected" error on version anthropic.claude-code-2.1.111-win32-x64

dotmari · 4 months ago

i have exactly the same error on w11 2.1.109 (supposedly "stable"). i have to use codex for reading now since there isnt a fast viable workaround :/

github-actions[bot] · 3 months ago

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

CrossStar · 2 months ago

Downloading the latest release of poppler-windows and adding the Library\bin folder to PATH should solve the issue. See: https://github.com/anthropics/claude-code/issues/66563#issuecomment-4699807250

Showing cached comments. Read the full discussion on GitHub ↗