[BUG] PreToolUse hook does not fire when Read tool reads image/binary files

Resolved 💬 1 comment Opened May 27, 2026 by itdove Closed Jul 1, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

When Claude Code reads an image file (PNG, JPEG, etc.) using the Read tool, the PreToolUse hook is not triggered. The image is sent directly to the model's vision capabilities. Only a PostToolUse hook fires afterward, with no output content.

For text files, PreToolUse fires correctly with the file_path in tool_input, allowing hooks to inspect or block the read. For image files, this step is skipped entirely.

This means any PreToolUse hook that validates, filters, or blocks file reads based on file path or content cannot intercept image file reads.

What Should Happen?

The PreToolUse hook should fire for Read tool calls on image/binary files, just as it does for text files. The hook data should include tool_input.file_path so hooks can inspect or block the read before it reaches the model.

Steps to Reproduce

  1. Create a PreToolUse hook in ~/.claude/settings.json that logs all tool calls:

``json
{
"hooks": {
"PreToolUse": [{
"matcher": "Read",
"hooks": [{
"type": "command",
"command": "echo '{\"hook\":\"PreToolUse\",\"tool\":\"Read\"}' >> /tmp/hook-log.txt"
}]
}]
}
}
``

  1. Ask Claude to read a text file: Read the file /path/to/test.txt
  2. Check /tmp/hook-log.txt — entry appears (PreToolUse fires correctly for text)
  3. Ask Claude to read an image file: Read the file /path/to/screenshot.png
  4. Check /tmp/hook-log.txtno new entry (PreToolUse does not fire for images)

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

2.1.150 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

This also affects the PostToolUse hook — when it does fire for image reads, the tool response contains no output, so hooks cannot inspect image content at any stage.

Related: #16592 (image data not available in UserPromptSubmit hooks either). Together, these two gaps mean there is no hook-based way to intercept or scan image content before it reaches the model.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗