Skip to content

Broken plugin hook blocks Edit/Write tools - missing cache file causes complete tool failure #16611

@jacopone

Description

@jacopone

Bug Report: Broken plugin hook blocks Edit/Write tools

Description

When a plugin hook references a file that doesn't exist in the cache, all Edit/Write/MultiEdit tool operations are blocked with an error. The user cannot proceed with any file modifications until the session is restarted with the plugin disabled.

Error Message

PreToolUse:Callback hook blocking error from command: "callback": /run/current-system/sw/bin/python3: can't open file '/home/guyfawkes/.claude/plugins/cache/claude-plugins-official/security-guidance/6d3752c000e2/hooks/security_reminder_hook.py': [Errno 2] No such file or directory

Steps to Reproduce

  1. Have a plugin installed that registers a PreToolUse hook (e.g., security-guidance@claude-plugins-official)
  2. The plugin cache gets corrupted/deleted, or the plugin version changes leaving stale references
  3. Try to use Edit, Write, or MultiEdit tools
  4. All operations are blocked with "No such file or directory" error

Expected Behavior

  • Claude Code should gracefully handle missing hook files (log warning, skip the hook)
  • OR disabling the plugin in settings.json should take effect immediately without requiring session restart

Actual Behavior

  • Tool operations are completely blocked
  • Disabling the plugin in settings.json has no effect until session restart
  • User is stuck and cannot make any file edits

Environment

  • Claude Code version: Latest
  • OS: NixOS Linux
  • Plugin: security-guidance@claude-plugins-official

Workaround

  1. Disable the plugin in ~/.claude/settings.json:
    "enabledPlugins": { "security-guidance@claude-plugins-official": false }
  2. Exit and restart Claude Code session

Suggested Fix

  1. Wrap hook execution in try-catch and gracefully handle missing files
  2. Validate hook file existence before attempting to execute
  3. Allow runtime plugin enable/disable without requiring restart

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolsbugSomething isn't workinghas reproHas detailed reproduction stepsplatform:linuxIssue specifically occurs on Linux

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions