Unknown hook name fails open instead of blocking the tool (v1.4.0) #6
Reference in New Issue
Block a user
Delete Branch "fix/5-unknown-hook-fail-open"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
main()answered an unknown or missingos.Args[1]withos.Exit(2), which Claude Code reads from a PreToolUse hook as "block this tool call" — so ahooks.json/binary skew removed the matched tool in every running session on the host.The file already failed open one line later ("an unreadable stdin is silence, exit 0"), so this was the one branch violating the contract the rest of it kept.
Unknown/missing entry point now prints a loud
unknown-entry-point:diagnostic to stderr naming the key and every registered name, then exits 0. A newlistsubcommand keeps the skew detectable.Verified before/after on the same probe:
bin/hooks not-a-real-hookexited 2, now exits 0.go testpasses.Fixes #5