claude-code - 💡(How to fix) Fix UserPromptSubmit hook failure blocks all input when plugin cache file is missing [Errno 2]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

try/except and sys.exit(0) error handling never executes. Claude Code

Error Messages/Logs

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.

Fix Action

Fix / Workaround

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.

Code Example

[Errno 2] No such file or directory: 'C:\Users\User\.claude\plugins\...\hooks\userpromptsubmit.py'
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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 or directory. Claude Code then blocks all user input, making the application completely unusable. Restarting does not resolve the issue.

Steps to Reproduce

  1. Install a plugin that registers a UserPromptSubmit hook (e.g., hookify)
  2. Plugin cache files are cleared or lost (e.g., after system cleanup)
  3. Restart Claude Code
  4. 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

  1. Install the hookify plugin from claude-plugin-marketplace-zh-tw
  2. Enable the plugin (sets UserPromptSubmit hook in settings.json)
  3. Clear or delete the plugin cache files (e.g., system cleanup or manual deletion)
  4. Restart Claude Code
  5. 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

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix UserPromptSubmit hook failure blocks all input when plugin cache file is missing [Errno 2]