From 10ce4e1a94ce18b6118ea29324e221c16c9953b5 Mon Sep 17 00:00:00 2001 From: danshapiro Date: Sun, 25 Jan 2026 15:01:30 -0800 Subject: [PATCH] Fix Windows startup hook failure caused by inherited SHELLOPTS On Windows with Git Bash, Claude Code can inherit a SHELLOPTS environment variable that includes the 'onecmd' option. When bash inherits this exported variable, it enables onecmd mode which causes scripts to exit after processing one compound command - breaking any script that uses 'set -euo pipefail'. This causes the SessionStart hook to fail with: "SessionStart:startup hook error" The fix uses 'env -u SHELLOPTS' to unset this variable before invoking bash, ensuring the script runs in a clean environment. Co-Authored-By: Claude Opus 4.5 --- hooks/hooks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/hooks.json b/hooks/hooks.json index 17e0ac87b..dc741d785 100644 --- a/hooks/hooks.json +++ b/hooks/hooks.json @@ -6,7 +6,7 @@ "hooks": [ { "type": "command", - "command": "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh" + "command": "env -u SHELLOPTS bash \"${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh\"" } ] }