UserPromptSubmit hook failure blocks all input when plugin cache file is missing [Errno 2]
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?
Bug Description
When a plugin's hook script file is missing (e.g., after cache is cleared),
the UserPromptSubmit hook fails at the OS level with [Errno 2] No such file . Claude Code then blocks all user input, making the application
or directory
completely unusable. Restarting does not resolve the issue.
Steps to Reproduce
- Install a plugin that registers a
UserPromptSubmithook (e.g., hookify) - Plugin cache files are cleared or lost (e.g., after system cleanup)
- Restart Claude Code
- Try to type any message
Expected Behavior
When a hook script file does not exist, Claude Code should skip the hook or
show a warning — it should NOT block user input.
Actual Behavior
Every input attempt triggers the missing hook, resulting in:
What Should Happen?
Claude Code becomes completely unusable. The issue persisted for several days
with no workaround except manually editing settings.json to remove the hook.
Root Cause
The hook command python3 "${CLAUDE_PLUGIN_ROOT}/hooks/userpromptsubmit.py"
fails at the OS level before Python even starts. The plugin's internal try/except and sys.exit(0) error handling never executes. Claude Code
receives a non-zero exit code and blocks UserPromptSubmit entirely.
Environment
- OS: Windows 11
- Plugin: hookify (claude-plugin-marketplace-zh-tw)
- Hook type: UserPromptSubmit
Suggested Fix
Non-zero exit codes from UserPromptSubmit hooks should degrade gracefully
(show a systemMessage warning) rather than blocking all input. This is
especially critical for UserPromptSubmit since a failure completely locks
the user out.
Error Messages/Logs
[Errno 2] No such file or directory: 'C:\Users\User\.claude\plugins\...\hooks\userpromptsubmit.py'
Steps to Reproduce
- Install the hookify plugin from claude-plugin-marketplace-zh-tw
- Enable the plugin (sets UserPromptSubmit hook in settings.json)
- Clear or delete the plugin cache files (e.g., system cleanup or manual deletion)
- Restart Claude Code
- Try to type any message in the input field
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
- Claude Code Version:
2.1.143 (Claude Code)- Platform:Windows 11
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_