-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Problem
Every Write or Edit call displays PreToolUse:Write hook error even though the hook runs correctly (exit 0, no output for non-protected files). This is a cosmetic TUI bug in Claude Code, not a bug in our handler.
Evidence
Handler is correct
The guard (hooks/handlers/pretooluse-guard.js) works perfectly in local testing:
# Non-protected file — exits 0, no output (= allow fast path)
echo '{"tool_input":{"file_path":"src/dera/config.py"}}' | node hooks/handlers/pretooluse-guard.js
# Exit code: 0, stdout: (empty)
# Protected file — exits 0, outputs ask decision
echo '{"tool_input":{"file_path":"plugin.json"}}' | node hooks/handlers/pretooluse-guard.js
# Exit code: 0, stdout: {"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"ask",...}}5 fix attempts made (all addressing the wrong root cause)
| Commit | What was tried |
|---|---|
5b54ddd |
Fix output format, updatedInput at top level |
d050fa9 |
Move updatedInput inside hookSpecificOutput, add permissionDecision: "allow" |
908881b |
Remove permissionDecision: "allow", move updatedInput back to top level |
cac01fe |
Move updatedInput inside hookSpecificOutput again, restore "allow" |
7d8e703 |
Remove all path normalization, simplify to bare minimum |
None of these fixed it because the bug is upstream.
Upstream Claude Code issues
- #17088 —
PreToolUse hook shows 'error' label even for successful (exit 0) hook runs(open, has repro, 9 comments) - #16950 —
[BUG] Error: PreToolUse:Write hook error(open)
Current behavior
Write(src/dera/config.py)
⎿ PreToolUse:Write hook error ← misleading label
The file is actually written — the "error" label is cosmetic only.
Impact
- No functional impact — writes succeed despite the label
- UX confusion — users (and Claude itself) see "error" and may incorrectly assume the operation failed
- Wasted effort — 5 commits trying to fix an unfixable upstream bug
Resolution
Blocked on upstream fix. Options:
- Wait for Claude Code to fix #17088 (labels:
bug,has repro,area:tui) - Remove the PreToolUse hook entirely to eliminate the cosmetic error (loses config protection)
- Accept the noise and document it as a known issue
Environment
- Claude Code: latest
- Node.js: v22.16.0
- Platform: Windows 11 (bash shell)
- Plugin: ucai v1.1.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels