fix(hooks): double-quote CLAUDE_PLUGIN_ROOT in hook commands #2

Closed
yoshi wants to merge 0 commits from fix/hooks-quoting-claude-plugin-root into main
Owner

Problem

Claude Code meldete bei jedem Tool-Call:

Failed with non-blocking status code: bash: ${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh: Datei oder Verzeichnis nicht gefunden

Alle drei Hooks (PostToolUse, Stop, SessionStart) waren tot — Auto-Compile, Session-Start usw. liefen nicht.

Ursache

In hooks/hooks.json waren die Pfade mit single quotes umschlossen:

"command": "bash '${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh'"

Bash expandiert Variablen in single quotes nicht, also wurde der wörtliche String ${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh an bash übergeben → "Datei nicht gefunden".

Fix

Single quotes → double quotes (escaped), analog zu anderen Plugins wie ralph-loop:

"command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh\""

Test

  • JSON validiert (python3 -m json.tool)
  • Cache-Kopie lokal überschrieben, Hook-Fehler verschwindet in laufenden Sessions
## Problem Claude Code meldete bei jedem Tool-Call: ``` Failed with non-blocking status code: bash: ${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh: Datei oder Verzeichnis nicht gefunden ``` Alle drei Hooks (PostToolUse, Stop, SessionStart) waren tot — Auto-Compile, Session-Start usw. liefen nicht. ## Ursache In `hooks/hooks.json` waren die Pfade mit **single quotes** umschlossen: ```json "command": "bash '${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh'" ``` Bash expandiert Variablen in single quotes nicht, also wurde der wörtliche String `${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh` an bash übergeben → "Datei nicht gefunden". ## Fix Single quotes → double quotes (escaped), analog zu anderen Plugins wie `ralph-loop`: ```json "command": "bash \"${CLAUDE_PLUGIN_ROOT}/hooks/post-tool-use.sh\"" ``` ## Test - JSON validiert (`python3 -m json.tool`) - Cache-Kopie lokal überschrieben, Hook-Fehler verschwindet in laufenden Sessions
Single quotes prevented bash from expanding ${CLAUDE_PLUGIN_ROOT}, causing
'Datei oder Verzeichnis nicht gefunden' for all three hooks
(PostToolUse, Stop, SessionStart).
Claude Code rejects the hook output without 'hookEventName' inside
hookSpecificOutput. Also drop the deprecated top-level 'additional_context'
field which is now redundant with hookSpecificOutput.additionalContext.
yoshi closed this pull request 2026-08-21 18:06:16 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yoshi/second-brain-skill!2
No description provided.