Plugin ralph-wiggum: PROMPT_PARTS unbound variable with set -u

Resolved 💬 3 comments Opened Mar 12, 2026 by marcoantoniofassa Closed Mar 16, 2026

Bug

/ralph-loop fails immediately with:

PROMPT_PARTS[*]: unbound variable

Root Cause

scripts/setup-ralph-loop.sh uses set -euo pipefail (line 6), but line 113 expands PROMPT_PARTS[*] without checking if the array has elements first:

PROMPT="${PROMPT_PARTS[*]}"

When the prompt is passed as a single quoted string by the Skill tool (or when --flags come before the prompt text), PROMPT_PARTS can be empty, and set -u (nounset) causes bash to error on the expansion.

Fix

Replace line 113:

# Before (buggy)
PROMPT="${PROMPT_PARTS[*]}"

# After (fixed)
if [[ ${#PROMPT_PARTS[@]} -gt 0 ]]; then
  PROMPT="${PROMPT_PARTS[*]}"
else
  PROMPT=""
fi

The empty-prompt case is already handled by the validation block on line 116-128, so this just lets it reach that check gracefully.

Environment

  • macOS 15 (Darwin 25.2.0)
  • bash 3.2 (Apple default) and bash 5.x (Homebrew)
  • Claude Code CLI, plugin version 1.0.0

View original on GitHub ↗

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