[BUG] Read tool (Claude Code Desktop): optional `pages` sent as "" fails validation on non-PDF
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?
On Claude Code Desktop, invoking Read on a non-PDF file (e.g. .md) fails when the optional pages argument is serialized as an empty string ("") instead of being omitted.
The tool rejects the call before returning file content:
Invalid pages parameter: "". Use formats like "1-5", "3", or "10-20". Pages are 1-indexed.
This breaks normal workflows that frequently Read Markdown (e.g. skill/agent prompts under ~/.claude/skills/.../agents/*.md). The failure repeats whenever the client/model emits pages: "".
What Should Happen?
- For non-PDF files,
pagesshould be irrelevant: ignorepages, or treat it as unset. - If
pagesis""or whitespace-only, normalize to unset and do not run the PDF page-range validator.
Expected: Read succeeds for .md / text / code when only file_path, limit, and offset are meaningful; optional pages must not break the call when empty.
Error Messages/Logs
Read
proactive-scout.md
file_path: C:\Users\AliceDev\.claude\skills\contoso-workflow\agents\proactive-scout.md
limit: 2000
offset: 0
pages:
Invalid pages parameter: "". Use formats like "1-5", "3", or "10-20". Pages are 1-indexed.
Steps to Reproduce
- Open Claude Code Desktop on Windows.
- In a session that can use tools, trigger Read on any Markdown file (e.g. a skill
agents/*.md). - Ensure the serialized tool input includes
pagesas an empty string (the UI/log showspages:with no value, orpages: ""). - Observe: validation error instead of file contents.
Note: Reproduction may depend on how the desktop client builds tool JSON (optional fields defaulting to ""). The bug is the strict validation on empty string rather than treating it as omitted.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude for Windows Claude 1.5354.0 (9a9e3d) 2026-04-29T01:14:34.000Z
Platform
Other
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
- Product: Claude Code Desktop (Windows).
- Suggested fix: coerce
pages === ""→ unset before validation; optionally skippagesvalidation entirely for non-PDF MIME types. - Related: optional tool fields often serialize as empty strings; validating
""like an invalid page range is overly strict.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗