{"record":{"id":"f8cd84f6305f8215","repo":"charmbracelet/crush","slug":"no-prompt-provided","errorCode":null,"errorMessage":"no prompt provided","messagePattern":"no prompt provided","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/cmd/run.go","lineNumber":86,"sourceCode":"\t\t\tsmallModel, _ = cmd.Flags().GetString(\"small-model\")\n\t\t\tsessionID, _  = cmd.Flags().GetString(\"session\")\n\t\t\tuseLast, _    = cmd.Flags().GetBool(\"continue\")\n\t\t)\n\n\t\t// Cancel on SIGINT or SIGTERM.\n\t\tctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, os.Kill)\n\t\tdefer cancel()\n\n\t\tprompt := strings.Join(args, \" \")\n\n\t\tprompt, err := MaybePrependStdin(prompt)\n\t\tif err != nil {\n\t\t\tslog.Error(\"Failed to read from stdin\", \"error\", err)\n\t\t\treturn err\n\t\t}\n\n\t\tif prompt == \"\" {\n\t\t\treturn fmt.Errorf(\"no prompt provided\")\n\t\t}\n\n\t\tevent.SetNonInteractive(true)\n\n\t\tswitch {\n\t\tcase sessionID != \"\":\n\t\t\tevent.SetContinueBySessionID(true)\n\t\tcase useLast:\n\t\t\tevent.SetContinueLastSession(true)\n\t\t}\n\n\t\tif useClientServer() {\n\t\t\tc, ws, cleanup, err := connectToServer(cmd)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tdefer cleanup()\n","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/charmbracelet/crush/blob/7944b8e52225d8805e31eacbf7ef24856b0dfb7a/internal/cmd/run.go#L68-L104","documentation":"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.","triggerScenarios":"`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.","commonSituations":"CI scripts forgetting to pass the prompt; variables that expand to empty (unset PROMPT env var); heredocs with no content; invoking `run` without arguments.","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"],"exampleFix":"// before: PROMPT unset, empty prompt\nPROMPT=\"\"; crush run \"$PROMPT\"\n// after: guard against empty prompt\n[ -n \"$PROMPT\" ] || { echo \"PROMPT is empty\" >&2; exit 1; }\ncrush run \"$PROMPT\"","handlingStrategy":"validation","validationCode":"prompt := strings.Join(args, \" \")\nif strings.TrimSpace(prompt) == \"\" {\n\treturn fmt.Errorf(\"no prompt provided\")\n}","typeGuard":null,"tryCatchPattern":"if err := runCmd.Execute(); err != nil {\n\tif strings.Contains(err.Error(), \"no prompt provided\") {\n\t\tslog.Error(\"Provide a prompt: crush run \\\"...\\\" or pipe content via stdin\")\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["cli","prompt","non-interactive"],"backgroundTag":"missing-required-argument","analyzedSha":"7944b8e52225d8805e31eacbf7ef24856b0dfb7a","analyzedAt":"2026-08-29T12:48:59.079Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}