[BUG] hookify fails with "Expecting ',' delimiter" on long PowerShell commands
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
hookify plugin fails with JSON parse error when PowerShell tool receives long commands (e.g., inline JavaScript in node -e).
Error appears on every PreToolUse and PostToolUse hook invocation:
PreToolUse:PowerShell says: Hookify error: Expecting ',' delimiter: line 1 column 1326 (char 1325)
PostToolUse:PowerShell says: Hookify error: Expecting ',' delimiter: line 1 column 1327 (char 1326)
What Should Happen?
hookify should handle long JSON input gracefully, either by:
- Truncating input before parsing
- Catching JSONDecodeError and returning empty result
- Increasing the stdin buffer size
Error Messages/Logs
Hookify error: Expecting ',' delimiter: line 1 column 1326 (char 1325)
Steps to Reproduce
- Use PowerShell tool with long inline scripts (e.g.,
node -e "..."with 1000+ chars) - hookify PreToolUse/PostToolUse hooks fail with JSON parse error
- Error appears in every tool call with long commands
Claude Model
Other
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.288
Platform
Other
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
The issue occurs because json.load(sys.stdin) in pretooluse.py and posttooluse.py fails when the input JSON is very long (typically >1000 chars). The error is caught by the generic exception handler, but the error message is confusing and appears on every tool call.
Related issues: #81448, #81670