Nonblocking PreToolUse hook failures repeat, truncate stderr, and never reach the agent

Status Open
Reported on v2.1.288
Maintainer reply None cached
Activity 1 comment · opened Oct 4, 2026

Reproduction

On Claude Code 2.1.288, configure several PreToolUse:Bash command hooks in a repository's .claude/settings.json. Each command invokes a Python hook using uv run python ci/hooks/<name>.py. Edit the working tree's pyproject.toml to pin a package version that is not yet published, then make any Bash tool call.

Every hook fails before its script starts. For about nine hooks, each Bash call displays nine copies of a nonblocking error. The displayed text stops at the first stderr line, such as No solution found when resolving dependencies for split (markers:, while the actionable last line (there is no version of <package>==<version>) is omitted. The agent's tool result contains none of these failures, so it cannot diagnose or repair the config.

Expected

  1. Show the agent the first distinct nonblocking hook failure as context attached to the tool result, with the hook name and the stderr root-cause line.
  2. Coalesce identical failures within one tool call into one line with a count.
  3. Preserve the stderr tail or provide a way to inspect the full failure from the agent.
  4. Keep the tool call nonblocking for exit codes other than 2.

The current hook documentation explicitly says the nonblocking notice carries only the first stderr line and full stderr requires debug logging. That is the behavior this issue asks to improve: https://code.claude.com/docs/en/hooks#other-exit-codes .

Tracked downstream at https://github.com/zackees/clud/issues/1739 . Clud can warn about fragile repo hook commands at launch (https://github.com/zackees/clud/pull/1795), but it cannot control how Claude Code renders or delivers native hook failures. Similar prior request #39646 was closed for filing process, not because the behavior changed.

View original on GitHub ↗

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