claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] PreToolUse hook with permissionDecision: "allow" causes intermittent "undefined is not an object (evaluating 'H.includes')" error

Open fprochazka opened this issue 3 months ago • 1 comments

Description

When a PreToolUse hook returns permissionDecision: "allow", Claude Code intermittently crashes with:

Error: undefined is not an object (evaluating 'H.includes')

The permissionDecision: "deny" path works correctly every time. The error appears to be in the client-side rendering code, not in the hook execution itself.

Environment

  • Platform: Linux (Ubuntu)
  • Claude Code version: 2.0.76
  • Node.js version: v22.x

Steps to Reproduce

  1. Create a PreToolUse hook that returns:
{
  "hookSpecificOutput": {
    "hookEventName": "PreToolUse",
    "permissionDecision": "allow",
    "permissionDecisionReason": ""
  }
}

Or install this: https://github.com/fprochazka/claude-code-plugins/tree/3b81c70464f0fcffc89ccef7b457e363b66657e1/plugins/no-background-tasks

  1. Trigger multiple parallel Bash tool calls

  2. The first tool that gets "allow" intermittently fails with the error

Hook Script (minimal reproduction)

#!/usr/bin/env python3
import json
import sys

hook_input = json.load(sys.stdin)

# Always allow
output = {
    "hookSpecificOutput": {
        "hookEventName": "PreToolUse",
        "permissionDecision": "allow",
        "permissionDecisionReason": ""
    }
}
print(json.dumps(output))
sys.exit(0)

Expected Behavior

The tool should execute normally when the hook returns permissionDecision: "allow".

Actual Behavior

Claude Code throws undefined is not an object (evaluating 'H.includes') intermittently.

Image

Debug Logs

When the hook works correctly, debug logs show:

Hook result has permissionBehavior=allow
Hook approved tool use for Bash, bypassing permission check

When it fails, the error is not logged in ~/.claude/debug/ - suggesting it's a client-side rendering error.

Notes

  • The error is intermittent - sometimes it works, sometimes it fails
  • permissionDecision: "deny" always works correctly
  • Adding permissionDecisionReason: "" (empty string) seems to reduce but not eliminate the error
  • The minified variable H suggests this is in bundled/minified Claude Code JavaScript

Workaround

None found. The error prevents reliable use of PreToolUse hooks that need to allow tool execution.

fprochazka avatar Jan 07 '26 11:01 fprochazka

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14620
  2. https://github.com/anthropics/claude-code/issues/11113
  3. https://github.com/anthropics/claude-code/issues/15897

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Jan 07 '26 11:01 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Jan 17 '26 14:01 github-actions[bot]