[BUG] `/ralph-wiggum:ralph-loop` has a problem with newline characters.

Resolved 💬 36 comments Opened Nov 23, 2025 by best-joker Closed Jan 5, 2026
💡 Likely answer: A maintainer (amorriscode, contributor) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When I use the /ralph-wiggum:ralph-loop command from the Claude Code plugin marketplace, my input is always judged as Command contains newlines that could separate multiple commands.
It seems that normal input in the Claude Code input box has issues — it gets automatically wrapped onto a new line 🤔.

What Should Happen?

Proceed correctly according to the plan.

Error Messages/Logs

Error: Bash command permission check failed for pattern "!
    "/home/joker/.claude/plugins/marketplaces/claude-code-plugins/plugins/ralph-wiggum/scripts/setup-ralph-loop.sh" "Build a MacOS-style
    frontend project that can open and run normally. Use liquid glass material effect, you can refer to
    @液态玻璃效果技术原理深度分析报告.md , think deeply, allow using various MCPs" --completion-promise Done --max-iterations 5

    # Extract and display completion promise if set
    if [ -f .claude/ralph-loop.local.md ]; then
      PROMISE=$(grep '^completion_promise:' .claude/ralph-loop.local.md | sed 's/completion_promise: *//' | sed 's/^"\(.*\)"$/\1/')
      if [ -n "$PROMISE" ] && [ "$PROMISE" != "null" ]; then
        echo ""
        echo "═══════════════════════════════════════════════════════════"
        echo "CRITICAL - Ralph Loop Completion Promise"
        echo "═══════════════════════════════════════════════════════════"
        echo ""
        echo "To complete this loop, output this EXACT text:"
        echo "  <promise>$PROMISE</promise>"
        echo ""
        echo "STRICT REQUIREMENTS (DO NOT VIOLATE):"
        echo "  ✓ Use <promise> XML tags EXACTLY as shown above"
        echo "  ✓ The statement MUST be completely and unequivocally TRUE"
        echo "  ✓ Do NOT output false statements to exit the loop"
        echo "  ✓ Do NOT lie even if you think you should exit"
        echo ""
        echo "IMPORTANT - Do not circumvent the loop:"
        echo "  Even if you believe you're stuck, the task is impossible,"
        echo "  or you've been running too long - you MUST NOT output a"
        echo "  false promise statement. The loop is designed to continue"
        echo "  until the promise is GENUINELY TRUE. Trust the process."
        echo ""
        echo "  If the loop should stop, the promise statement will become"
        echo "  true naturally. Do not force it by lying."
        echo "═══════════════════════════════════════════════════════════"
      fi
    fi
    ": Command contains newlines that could separate multiple commands

Steps to Reproduce

Run 2.0.50 (Claude Code) in Windows Terminal on Win 11 and enter /ralph-wiggum:ralph-loop "Build a MacOS-style frontend project that can open and run normally. Use liquid glass material effect, you can refer to @液态玻璃效果技术原理深度分析报告.md , think deeply, allow using various MCPs" --completion-promise Done --max-iterations 5

Claude Model

Other

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.0.50 (Claude Code)

Platform

Other

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

36 Comments

github-actions[bot] · 7 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/9323
  2. https://github.com/anthropics/claude-code/issues/6660

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

best-joker · 7 months ago

The issue they mentioned is not the same as the one I'm referring to.

Hugo-Prossaird · 7 months ago
The issue they mentioned is not the same as the one I'm referring to.

Yes, the issue they mentioned is different. By the way, I can reproduce the issue too 😕

martinsonofori · 7 months ago

I can also reproduce same in Claude Code on Mac.

frees11 · 7 months ago

me too on macos, is there any workaround?

Hugo-Prossaird · 7 months ago

I asked Claude to update the plugin based on https://github.com/anthropics/claude-code/pull/12642 and it works @frees11 @mqofori for information

ArthurSrz · 7 months ago

I can also reproduce the issue.

sentineladmin234 · 7 months ago

I can also reproduce the issue.

covagashi · 7 months ago

can also reproduce same in Claude Code w11

1yian · 7 months ago

can also reproduce this issue

pollychrome · 7 months ago

can also reproduce this issue

jes5199 · 6 months ago

in frustration, I forked it: https://github.com/jes5199/chief-wiggum

ciefa · 6 months ago

Has anyone found a solution to this? I tried some workarounds but none of them worked :(

Sebastian-Geocento · 6 months ago

Can reproduce on Linux

Environment:

  • OS: Linux (Arch Linux 6.17.9)
  • Claude Code version: Latest (Dec 2025)
  • Platform: Anthropic API

Affected commands:

  • /ralph-wiggum:ralph-loop
  • /ralph-wiggum:cancel-ralphalso affected, same root cause

Error message for /cancel-ralph:

Error: Bash command permission check failed for pattern "```!
if [[ -f .claude/ralph-loop.local.md ]]; then
  ITERATION=$(grep '^iteration:' .claude/ralph-loop.local.md | sed 's/iteration: *//')
  echo "FOUND_LOOP=true"
  echo "ITERATION=$ITERATION"
else
  echo "FOUND_LOOP=false"
fi
```": Command contains newlines that could separate multiple commands

Root cause analysis:
The Skill tool is passing the raw markdown block (including the `! code fence markers) directly to the Bash permission checker, instead of:

  1. Recognizing the `! syntax as an executable block
  2. Extracting just the bash commands inside
  3. Executing them properly

Workaround:
Manually run rm -f .claude/ralph-loop.local.md to cancel the loop.

yanbo-fang-ai · 6 months ago

@dhollman @dicksontsai (as the original author/reviewer) could you take a look/approve the fix? this bug is blocking a lot of folks from using the stop hook.

whoisjuan · 6 months ago

Same issue here. Even when the prompt is inlined, it seems like a new line is still added that triggers this error.

The only way I have been able to run this is by doing:

"/path/to/setup-ralph-loop.sh" "<task description>" --max-iterations <number> --completion-promise "<promise text>"

kakapo1933 · 6 months ago

Can reproduce this issue too. A workaround is to use the bypassPermissions. It's not ideal.

houxiufeng · 6 months ago

I can also reproduce the issue. on macos tahoe 26.1, apple m5 chips

ErzhongHoo · 6 months ago

Same issue on Archlinux

hoverlover · 6 months ago

Same here, OSX Sequoia 15.6.1, Claude Code 2.0.76 running in zsh.

dial481 · 6 months ago

Alternative Fix: No Bash Execution in Command Files

There's an open PR for this issue (#12642). Meanwhile, users keep filing duplicates:

  • #15640 (Dec 29) - closed as duplicate
  • #15708 (Dec 29)
  • #15712 (Dec 29)
  • #16037 (Jan 1)

I've published a working reimplementation with a different architectural approach:

github.com/dial481/ralph

Why PR #12642's Approach May Not Be Enough

The PR moves multi-line bash into setup-ralph-loop.sh, but the command file still uses ``` `bash ``` with instructions for Claude to execute it. This still involves bash execution from the command context.

Alternative Approach: Zero Bash in Command Files

The command file is pure markdown instructions. Claude uses its Write tool to create the state file—no bash execution in the command at all:

---
description: Start autonomous iteration loop
---
# Ralph Loop
Parse arguments: $ARGUMENTS
Create `.claude/ralph-loop.local.md` with your Write tool...

The stop hook (which runs outside Claude's permission system) handles all the loop logic.

Result: No newlines, no $(), no permission conflicts. Works with current Claude Code security restrictions.

Tested On

  • macOS, Claude Code 2.0.76
  • Correctly loops through iterations
  • Detects completion promise
  • Respects max iterations
Takhoffman · 6 months ago

The fix is to run claude with --dangerously-skip-permissions (claude --dangerously-skip-permissions) which means you should only run this in a sandbox or a separate VM.

crobbo · 6 months ago
The fix is to run claude with --dangerously-skip-permissions (claude --dangerously-skip-permissions) which means you should only run this in a sandbox or a separate VM.

Does not work for me.

I'm using arch + ghostty terminal.

israelmuca · 6 months ago

Additional data point: Manual patching doesn't work

Environment: macOS (Darwin 25.1.0), Claude Code latest

I'm experiencing the same issue and attempted the workaround from PR #12642 / PR #114 by manually patching the local plugin files.

What I tried:

Patched all three local copies of ralph-loop.md to remove the multi-line bash (keeping only the single-line script call):

  1. ~/.claude/plugins/cache/claude-plugins-official/ralph-wiggum/6d3752c000e2/commands/ralph-loop.md
  2. ~/.claude/plugins/cache/claude-plugins-official/ralph-wiggum/unknown/commands/ralph-loop.md
  3. ~/.claude/plugins/marketplaces/claude-plugins-official/plugins/ralph-wiggum/commands/ralph-loop.md

Also updated the corresponding setup-ralph-loop.sh scripts to include the completion promise display logic.

Result:

Still fails with the same error, even after:

  • Fully quitting and restarting Claude Code
  • Starting a new conversation
  • Verifying the patched files are still on disk (they are - patches persist)

Conclusion:

Claude Code appears to be loading the plugin content from somewhere other than these local files - possibly:

  • Fetching from the remote plugin registry on startup
  • Some internal cache that persists across restarts and isn't stored in these directories

The patches are definitely on disk (verified with cat), but Claude Code still shows the old multi-line content in the error message.

Suggestion: The fix in PR #114 needs to be merged to the remote registry for local patches to be ineffective.

amorriscode contributor · 6 months ago
sapoepsilon · 6 months ago

I am getting the bug with the official plugin:

<img width="1509" height="384" alt="Image" src="https://github.com/user-attachments/assets/47260c83-16ba-4431-8e56-958eef1d404e" /> @amorriscode

gabimoncha · 6 months ago

@amorriscode still an issue. i just reinstalled the plugin and have the same error

jsanderssk · 6 months ago

His commit fixes the issue
But you can also
``
---
`!
"${CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh" $ARGUMENTS
---
``


in `commands/ralph-loop.md`
sapoepsilon · 6 months ago

@jsanderssk I don't understand how his commit fixes the issue if it literally not working out of the box after the installation. Also, I can't find this directory: {CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh. Like, I don't have any scripts in my claude plugin directory. Am I missing anything?

jsanderssk · 6 months ago
@jsanderssk I don't understand how his commit fixes the issue if it literally not working out of the box after the installation. Also, I can't find this directory: {CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh. Like, I don't have any scripts in my claude plugin directory. Am I missing anything?

@sapoepsilon
The issue is the claude is sending the markdown ` and that is causing an issue. So instead we just remove them and claude just executes the script. You may still be prompted for permission. if you look search for the file ralph-loop.md

find .claude/plugins/cache/claude-plugins-official/ralph-wiggum \
  -type f \
  -path '*/commands/ralph-loop.md' \
  ! -path '*/unknown/*'

Find the one that matches the error and remove the troublesome block of code

sapoepsilon · 6 months ago
> @jsanderssk I don't understand how his commit fixes the issue if it literally not working out of the box after the installation. Also, I can't find this directory: {CLAUDE_PLUGIN_ROOT}/scripts/setup-ralph-loop.sh. Like, I don't have any scripts in my claude plugin directory. Am I missing anything? @sapoepsilon The issue is the claude is sending the markdown ` ` and that is causing an issue. So instead we just remove them and claude just executes the script. You may still be prompted for permission. if you look search for the file ralph-loop.md ` find .claude/plugins/cache/claude-plugins-official/ralph-wiggum \ -type f \ -path '*/commands/ralph-loop.md' \ ! -path '*/unknown/*' `` Find the one that matches the error and remove the troublesome block of code

@jsanderssk You are the MVP thanks, that did the trick. I opened up a PR: https://github.com/anthropics/claude-plugins-official/pull/134

mjtechguy · 6 months ago

For multi line, couldn't we just pass the entire file with all content as a base64 encoded string since Claude can decrypt it? Then bash wouldn't struggle with any weird formatting or new lines.

yigitkonur · 6 months ago

awesome feature but the dev experience is so terrible that I hope it gets fixeed soon

mishterk · 6 months ago

Just weighing in — I've installed the plugin via the /plugin command in Claude Code and I'm still getting that same error:

> /ralph-loop:ralph-loop 'make a simple html document to test' 
  ⎿  Error: Bash command permission check failed for pattern "```!
     "/Users/.../.claude/plugins/cache/claude-plugins-official/ralph-loop/b97f6eadd929/scripts/setup-ralph-loop.sh" 'make a simple html document to test'
     ```": This command requires approval

I deleted the cached versions of the plugins from my Mac and reinstalled but still the same result.

sapoepsilon · 6 months ago

I was able to solve that problem in my PR, check it out: https://github.com/anthropics/claude-plugins-official/pull/134
@mishterk

github-actions[bot] · 6 months ago

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.