charmbracelet/crush · error
no prompt provided
Error message
no prompt provided
What it means
Returned by the non-interactive `crush run` command when the resolved prompt is empty. In non-interactive mode there is no TUI to type into, so a prompt must come from arguments or stdin; if reading stdin yields nothing, the command cannot proceed.
Source
Thrown at internal/cmd/run.go:86
smallModel, _ = cmd.Flags().GetString("small-model")
sessionID, _ = cmd.Flags().GetString("session")
useLast, _ = cmd.Flags().GetBool("continue")
)
// Cancel on SIGINT or SIGTERM.
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)
defer cancel()
prompt := strings.Join(args, " ")
prompt, err := MaybePrependStdin(prompt)
if err != nil {
slog.Error("Failed to read from stdin", "error", err)
return err
}
if prompt == "" {
return fmt.Errorf("no prompt provided")
}
event.SetNonInteractive(true)
switch {
case sessionID != "":
event.SetContinueBySessionID(true)
case useLast:
event.SetContinueLastSession(true)
}
if useClientServer() {
c, ws, cleanup, err := connectToServer(cmd)
if err != nil {
return err
}
defer cleanup()
View on GitHub (pinned to 7944b8e522)
Solutions
- Pass the prompt as an argument: `crush run "fix the failing test"`
- Pipe content via stdin: `cat task.md | crush run`
- Check that the variable supplying the prompt is non-empty before invoking
- Review the command for quoting errors that collapse the argument to an empty string
Example fix
// before: PROMPT unset, empty prompt
PROMPT=""; crush run "$PROMPT"
// after: guard against empty prompt
[ -n "$PROMPT" ] || { echo "PROMPT is empty" >&2; exit 1; }
crush run "$PROMPT" Defensive patterns
Strategy: validation
Validate before calling
prompt := strings.Join(args, " ")
if strings.TrimSpace(prompt) == "" {
return fmt.Errorf("no prompt provided")
} Try / catch
if err := runCmd.Execute(); err != nil {
if strings.Contains(err.Error(), "no prompt provided") {
slog.Error("Provide a prompt: crush run \"...\" or pipe content via stdin")
}
return err
} Prevention
- Validate shell variables feeding the prompt are non-empty
- Prefer passing the prompt as a positional argument in scripts
- Quote arguments correctly so they don't collapse to empty strings
- Check stdin redirection when relying on piped input
When it happens
Trigger: `crush run` with no positional argument while stdin is empty or a TTY redirect is closed; piping an empty stream (`echo -n | crush run`); quoting mistakes that pass an empty string as the prompt.
Common situations: CI scripts forgetting to pass the prompt; variables that expand to empty (unset PROMPT env var); heredocs with no content; invoking `run` without arguments.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- ${sessionList} Use more characters or the full hash
- error creating prompt: %s
- parsing template: %w
- executing template: %w
- cannot continue an agent tool session: %s
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/f8cd84f6305f8215.
Report an issue: GitHub.