ralph-loop plugin stop-hook causes infinite loop when Windows username contains spaces

Resolved 💬 3 comments Opened Mar 12, 2026 by Guiquan-27 Closed Mar 16, 2026

Bug Description

The ralph-loop plugin's stop-hook.sh causes an infinite error loop when the Windows username contains spaces (e.g., Guiquan Wang). Every response from Claude triggers the hook, which fails, and the error feedback triggers another response, creating an unbreakable infinite loop.

Environment

  • OS: Windows 11 Pro 10.0.26200
  • Shell: Git Bash (via VSCode extension)
  • Windows Username: Guiquan Wang (contains a space)
  • HOME path: /c/Users/Guiquan Wang/
  • Plugin: ralph-loop@claude-plugins-official

Error Message (repeating infinitely)

Stop hook feedback:
[${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh]: /c/Users/Guiquan: line 1: syntax error near unexpected token `('
/c/Users/Guiquan: line 1: `[F14C:C390][2025-07-04T23:18:52]i001: Burn v3.14.1.8722, Windows v10.0 (Build 26100: Service Pack 0), path: C:\WINDOWS\Temp\{386C9DBA-8BF0-4D12-A9BC-223877FDF90E}\.cr\VC_redist.x64.exe'

Root Cause Analysis

  1. The ${CLAUDE_PLUGIN_ROOT} variable resolves to a path containing a space (e.g., /c/Users/Guiquan Wang/.claude/plugins/...).
  2. When the plugin system invokes the hook, the path is not properly quoted, causing bash to split it at the space.
  3. Bash then tries to execute /c/Users/Guiquan as a script (the first half of the split path), which is not a valid script.
  4. A VC++ Redistributable installer log (or other system output) appears to be fed into stdin, further confusing the shell.
  5. The hook error is treated as user feedback, triggering another Claude response, which triggers the hook again — creating an infinite loop that cannot be broken from within the session.

Impact

  • Severity: High — the session becomes completely unusable
  • The loop cannot be stopped from within Claude Code. The user must manually close the terminal/VSCode window.
  • Even replacing stop-hook.sh content with exit 0 and clearing hooks.json did not help during the active session, because the hook path was already cached in memory with the unquoted path.
  • The fix only took effect after restarting the session.

Steps to Reproduce

  1. Use Windows with a username that contains a space (e.g., Guiquan Wang)
  2. Install and enable the ralph-loop plugin
  3. Start a Claude Code session (VSCode extension)
  4. Send any message and wait for a response
  5. Observe the infinite stop-hook error loop

Expected Behavior

The hook path should be properly quoted to handle spaces in file paths on Windows.

Suggested Fix

In the plugin system's hook invocation code, ensure the resolved ${CLAUDE_PLUGIN_ROOT} path is properly quoted when passed to bash, e.g.:

# Instead of:
bash ${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh

# Use:
bash "${CLAUDE_PLUGIN_ROOT}/hooks/stop-hook.sh"

Workaround

  1. Disable ralph-loop in settings.json by setting "ralph-loop@claude-plugins-official": false (or removing it)
  2. Replace all stop-hook.sh files with #!/bin/bash\nexit 0
  3. Clear hooks.json registration: {"description":"disabled","hooks":{}}
  4. Restart the Claude Code session (changes don't take effect in the current session)

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗