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:

  1. Register a PreToolUse hook with matcher: "Read" that just logs stdin to a file.
  2. Read a plain .txt/.md file → hook fires, log written.
  3. Read a .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).

View original on GitHub ↗