Read tool never triggers PreToolUse hooks for binary files (Desktop App, "Code" tab)
Status Open
Maintainer reply None cached
Activity 0 comments · opened Sep 10, 2026
When reading a file that the Read tool detects as binary (e.g. .docx, .xlsx, .dwg), the tool short-circuits directly to its own "This tool cannot read binary files" error — PreToolUse hooks registered with matcher: "Read" never fire for these calls.
For plain text files, the same hook fires normally (confirmed via a debug hook logging the raw stdin payload — text read logged tool_name: "Read" correctly; binary read logged nothing).
This breaks any hook designed to intercept binary files before the built-in rejection (e.g. converting .docx/.xlsx to Markdown via markitdown, or rendering .dwg to PNG, before Read sees them).
Repro:
- Register a
PreToolUsehook withmatcher: "Read"that just logsstdinto a file. Reada plain.txt/.mdfile → hook fires, log written.Reada.docx/binary file → hook does NOT fire, log stays empty, tool returns its generic binary-file rejection instead.
Environment: Claude Code Desktop App, "Code" tab (not the standalone CLI — not yet re-tested there).