[GH-ISSUE #32] Stop hook error: Failed with non-blocking status code: '${CLAUDE_PLUGIN_ROOT}' #24

Open
opened 2026-03-03 18:50:03 +03:00 by kerem · 3 comments
Owner

Originally created by @mtuwei on GitHub (Jan 17, 2026).
Original GitHub issue: https://github.com/OthmanAdi/planning-with-files/issues/32

Trouble shoot:
Image

System info.:

  • OS: Win 11
  • TUI:PowerShell
Originally created by @mtuwei on GitHub (Jan 17, 2026). Original GitHub issue: https://github.com/OthmanAdi/planning-with-files/issues/32 Trouble shoot: <img width="975" height="134" alt="Image" src="https://github.com/user-attachments/assets/3b56ffdc-8fe7-4302-a227-e2bd011534c5" /> System info.: - OS: Win 11 - TUI:PowerShell
Author
Owner

@OthmanAdi commented on GitHub (Jan 17, 2026):

Hi @mtuwei,

First, my sincere apologies for the delayed response. Thank you for reporting this issue and providing the system details – that was extremely helpful!

This is now FIXED in v2.2.0

I've just released v2.2.0 which includes comprehensive Windows PowerShell support. This completely resolves the ${CLAUDE_PLUGIN_ROOT} and Stop hook issues you encountered.

What Was Wrong

The issue had two root causes:

  1. Script Incompatibility: The check-complete.sh bash script doesn't run natively in PowerShell
  2. Environment Variable: ${CLAUDE_PLUGIN_ROOT} has known resolution issues on Windows (documented Claude Code bug)

What's Fixed

New PowerShell Scripts:

  • Created check-complete.ps1 - PowerShell equivalent of the bash script
  • Created init-session.ps1 - PowerShell session initialization
  • Scripts available in all locations for maximum compatibility

OS-Aware Hook Execution:
The Stop hook now automatically detects your operating system and uses the appropriate script:

  • Windows → Uses PowerShell (.ps1 files)
  • Mac/Linux → Uses Bash (.sh files)
  • Automatic fallback chain if one doesn't work

How to Update

# Uninstall current version
/plugin uninstall planning-with-files@planning-with-files

# Re-add marketplace
/plugin marketplace add OthmanAdi/planning-with-files

# Install v2.2.0
/plugin install planning-with-files@planning-with-files

After updating, the Stop hook should work perfectly on Windows 11 PowerShell!

Technical Details

The hook now uses this logic:

if Windows detected:
  try PowerShell Core (pwsh)
  else try Windows PowerShell (powershell)
  else fallback to bash (Git Bash)
else:
  use bash

Want to Verify?

After updating, you can test the completion check manually:

# In PowerShell
powershell -ExecutionPolicy Bypass -File scripts/check-complete.ps1

Thank you again for this report! Your issue helped make planning-with-files work for all Windows users. I've added you to the acknowledgments in CHANGELOG.md and CONTRIBUTORS.md.

Let me know if you encounter any issues with v2.2.0!

Best regards,
Ahmad

<!-- gh-comment-id:3764300159 --> @OthmanAdi commented on GitHub (Jan 17, 2026): Hi @mtuwei, First, my sincere apologies for the delayed response. Thank you for reporting this issue and providing the system details – that was extremely helpful! ## ✅ This is now FIXED in v2.2.0 I've just released v2.2.0 which includes comprehensive Windows PowerShell support. This completely resolves the `${CLAUDE_PLUGIN_ROOT}` and Stop hook issues you encountered. ### What Was Wrong The issue had two root causes: 1. **Script Incompatibility**: The `check-complete.sh` bash script doesn't run natively in PowerShell 2. **Environment Variable**: `${CLAUDE_PLUGIN_ROOT}` has known resolution issues on Windows (documented Claude Code bug) ### What's Fixed **New PowerShell Scripts:** - ✅ Created `check-complete.ps1` - PowerShell equivalent of the bash script - ✅ Created `init-session.ps1` - PowerShell session initialization - ✅ Scripts available in all locations for maximum compatibility **OS-Aware Hook Execution:** The Stop hook now automatically detects your operating system and uses the appropriate script: - Windows → Uses PowerShell (.ps1 files) - Mac/Linux → Uses Bash (.sh files) - Automatic fallback chain if one doesn't work ### How to Update ```bash # Uninstall current version /plugin uninstall planning-with-files@planning-with-files # Re-add marketplace /plugin marketplace add OthmanAdi/planning-with-files # Install v2.2.0 /plugin install planning-with-files@planning-with-files ``` After updating, the Stop hook should work perfectly on Windows 11 PowerShell! ### Technical Details The hook now uses this logic: ```bash if Windows detected: try PowerShell Core (pwsh) else try Windows PowerShell (powershell) else fallback to bash (Git Bash) else: use bash ``` ### Want to Verify? After updating, you can test the completion check manually: ```powershell # In PowerShell powershell -ExecutionPolicy Bypass -File scripts/check-complete.ps1 ``` --- **Thank you again** for this report! Your issue helped make planning-with-files work for all Windows users. I've added you to the acknowledgments in CHANGELOG.md and CONTRIBUTORS.md. Let me know if you encounter any issues with v2.2.0! Best regards, Ahmad
Author
Owner

@aqlkzf commented on GitHub (Jan 21, 2026):

First of all, thanks for the great tool!
I encountered this issue on my Linux system (Ubuntu). The detailed description is below.

Title

Stop hook in ralph-loop plugin fails with /bin/sh: [[: not found on Ubuntu/Debian

Description

Problem

When the ralph-loop plugin's stop hook runs, it fails with the following error:

Ran 1 stop hook
  ⎿  Stop hook error: Failed with non-blocking status code: /bin/sh: 1: [[: not found
  /bin/sh: 1: : Permission denied
  /bin/sh: 1: : Permission denied

Root Cause

The script ~/.claude/plugins/marketplaces/claude-plugins-official/plugins/ralph-loop/hooks/stop-hook.sh has a #!/bin/bash shebang but is being executed with /bin/sh.

On Ubuntu/Debian systems, /bin/sh is symlinked to dash, which doesn't support bash-specific [[ syntax.

The script uses [[ extensively (lines 15, 28, 39, 51, 60, 82, 98, 107, 115, 123, 138, 159):

if [[ ! -f "$RALPH_STATE_FILE" ]]; then
if [[ ! "$ITERATION" =~ ^[0-9]+$ ]]; then
# ... etc

Possible Causes

  1. Claude Code ignores shebang: The hook executor may be using /bin/sh regardless of the script's shebang line
  2. Permission issue: The "Permission denied" errors suggest the script may not be executable, causing fallback to /bin/sh -c

Environment

  • OS: Ubuntu 24.04 (Linux 6.14.0-37-generic)
  • Shell: bash (user shell)
  • /bin/sh: dash (Debian default)
  • Claude Code version: 2.1.x
<!-- gh-comment-id:3776651743 --> @aqlkzf commented on GitHub (Jan 21, 2026): First of all, thanks for the great tool! I encountered this issue on my Linux system (Ubuntu). The detailed description is below. ## Title Stop hook in `ralph-loop` plugin fails with `/bin/sh: [[: not found` on Ubuntu/Debian ## Description ### Problem When the `ralph-loop` plugin's stop hook runs, it fails with the following error: ``` Ran 1 stop hook ⎿ Stop hook error: Failed with non-blocking status code: /bin/sh: 1: [[: not found /bin/sh: 1: : Permission denied /bin/sh: 1: : Permission denied ``` ### Root Cause The script `~/.claude/plugins/marketplaces/claude-plugins-official/plugins/ralph-loop/hooks/stop-hook.sh` has a `#!/bin/bash` shebang but is being executed with `/bin/sh`. On Ubuntu/Debian systems, `/bin/sh` is symlinked to `dash`, which doesn't support bash-specific `[[` syntax. The script uses `[[` extensively (lines 15, 28, 39, 51, 60, 82, 98, 107, 115, 123, 138, 159): ```bash if [[ ! -f "$RALPH_STATE_FILE" ]]; then if [[ ! "$ITERATION" =~ ^[0-9]+$ ]]; then # ... etc ``` ### Possible Causes 1. **Claude Code ignores shebang**: The hook executor may be using `/bin/sh` regardless of the script's shebang line 2. **Permission issue**: The "Permission denied" errors suggest the script may not be executable, causing fallback to `/bin/sh -c` ### Environment - **OS**: Ubuntu 24.04 (Linux 6.14.0-37-generic) - **Shell**: bash (user shell) - **`/bin/sh`**: dash (Debian default) - **Claude Code version**: 2.1.x
Author
Owner

@SaladDay commented on GitHub (Jan 24, 2026):

First of all, thanks for the great tool!首先,感谢这个伟大的工具! I encountered this issue on my Linux system (Ubuntu). The detailed description is below.我在我的 Linux 系统(Ubuntu)上遇到了这个问题。详细描述如下。

Title  标题

Stop hook in ralph-loop plugin fails with /bin/sh: [[: not found on Ubuntu/Debian在 ralph-loop 插件中的停止钩子在 Ubuntu/Debian 上失败,错误为 /bin/sh: [[: not found

Description  描述

Problem

When the ralph-loop plugin's stop hook runs, it fails with the following error:当 ralph-loop 插件的停止钩子运行时,它以以下错误失败:

Ran 1 stop hook
  ⎿  Stop hook error: Failed with non-blocking status code: /bin/sh: 1: [[: not found
  /bin/sh: 1: : Permission denied
  /bin/sh: 1: : Permission denied

Root Cause

The script ~/.claude/plugins/marketplaces/claude-plugins-official/plugins/ralph-loop/hooks/stop-hook.sh has a #!/bin/bash shebang but is being executed with /bin/sh.脚本 ~/.claude/plugins/marketplaces/claude-plugins-official/plugins/ralph-loop/hooks/stop-hook.sh 有一个 #!/bin/bash 的 shebang,但正在使用 /bin/sh 执行。

On Ubuntu/Debian systems, /bin/sh is symlinked to dash, which doesn't support bash-specific [[ syntax.在 Ubuntu/Debian 系统上, /bin/sh 被链接到 dash ,它不支持 bash 特定的 [[ 语法。

The script uses [[ extensively (lines 15, 28, 39, 51, 60, 82, 98, 107, 115, 123, 138, 159):脚本广泛使用 [[ (第 15 行、28 行、39 行、51 行、60 行、82 行、98 行、107 行、115 行、123 行、138 行、159 行):

if ! -f "$RALPH_STATE_FILE" ; then
if [[ ! "ITERATION" =~ ^[0-9]+ ]]; then

... etc

Possible Causes

  1. Claude Code ignores shebang: The hook executor may be using /bin/sh regardless of the script's shebang lineClaude Code 忽略 shebang:钩子执行器可能在使用 /bin/sh ,而不管脚本的 shebang 行
  2. Permission issue: The "Permission denied" errors suggest the script may not be executable, causing fallback to /bin/sh -c权限问题:“权限被拒绝”错误表明脚本可能不可执行,导致回退到 /bin/sh -c

Environment

  • OS: Ubuntu 24.04 (Linux 6.14.0-37-generic)操作系统:Ubuntu 24.04(Linux 6.14.0-37-generic)
  • Shell: bash (user shell)  Shell: bash (用户 Shell)
  • /bin/sh: dash (Debian default) /bin/sh : dash (Debian 默认)
  • Claude Code version: 2.1.xClaude Code 版本:2.1.x

I've encountered this problem too. ubuntu20.04

<!-- gh-comment-id:3794791990 --> @SaladDay commented on GitHub (Jan 24, 2026): > First of all, thanks for the great tool!首先,感谢这个伟大的工具! I encountered this issue on my Linux system (Ubuntu). The detailed description is below.我在我的 Linux 系统(Ubuntu)上遇到了这个问题。详细描述如下。 > > ## Title  标题 > Stop hook in `ralph-loop` plugin fails with `/bin/sh: [[: not found` on Ubuntu/Debian在 `ralph-loop` 插件中的停止钩子在 Ubuntu/Debian 上失败,错误为 `/bin/sh: [[: not found` > > ## Description  描述 > ### Problem > When the `ralph-loop` plugin's stop hook runs, it fails with the following error:当 `ralph-loop` 插件的停止钩子运行时,它以以下错误失败: > > ``` > Ran 1 stop hook > ⎿ Stop hook error: Failed with non-blocking status code: /bin/sh: 1: [[: not found > /bin/sh: 1: : Permission denied > /bin/sh: 1: : Permission denied > ``` > > ### Root Cause > The script `~/.claude/plugins/marketplaces/claude-plugins-official/plugins/ralph-loop/hooks/stop-hook.sh` has a `#!/bin/bash` shebang but is being executed with `/bin/sh`.脚本 `~/.claude/plugins/marketplaces/claude-plugins-official/plugins/ralph-loop/hooks/stop-hook.sh` 有一个 `#!/bin/bash` 的 shebang,但正在使用 `/bin/sh` 执行。 > > On Ubuntu/Debian systems, `/bin/sh` is symlinked to `dash`, which doesn't support bash-specific `[[` syntax.在 Ubuntu/Debian 系统上, `/bin/sh` 被链接到 `dash` ,它不支持 bash 特定的 `[[` 语法。 > > The script uses `[[` extensively (lines 15, 28, 39, 51, 60, 82, 98, 107, 115, 123, 138, 159):脚本广泛使用 `[[` (第 15 行、28 行、39 行、51 行、60 行、82 行、98 行、107 行、115 行、123 行、138 行、159 行): > > if [[ ! -f "$RALPH_STATE_FILE" ]]; then > if [[ ! "$ITERATION" =~ ^[0-9]+$ ]]; then > # ... etc > ### Possible Causes > 1. **Claude Code ignores shebang**: The hook executor may be using `/bin/sh` regardless of the script's shebang lineClaude Code 忽略 shebang:钩子执行器可能在使用 `/bin/sh` ,而不管脚本的 shebang 行 > 2. **Permission issue**: The "Permission denied" errors suggest the script may not be executable, causing fallback to `/bin/sh -c`权限问题:“权限被拒绝”错误表明脚本可能不可执行,导致回退到 `/bin/sh -c` > > ### Environment > * **OS**: Ubuntu 24.04 (Linux 6.14.0-37-generic)操作系统:Ubuntu 24.04(Linux 6.14.0-37-generic) > * **Shell**: bash (user shell)  Shell: bash (用户 Shell) > * **`/bin/sh`**: dash (Debian default) `/bin/sh` : dash (Debian 默认) > * **Claude Code version**: 2.1.xClaude Code 版本:2.1.x I've encountered this problem too. ubuntu20.04
Sign in to join this conversation.
No labels
bug
pull-request
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
starred/planning-with-files#24
No description provided.