nikivdev/code · error

prompt is empty

Error message

prompt is empty

What it means

Thrown by resolve_prompt() in the `f ai everruns` command when a prompt argument list was supplied but joining its parts and trimming yields an empty string. The guard prevents launching everruns with a blank prompt, which would be meaningless work for the AI runner.

Source

Thrown at src/ai_everruns.rs:92

        Err(err) => rl_signals::emit(json!({
            "event_type": "everruns.run_failed",
            "runtime": "everruns",
            "session_id": session_id,
            "input_message_id": message_id,
            "ok": false,
            "runtime_ms": runtime_ms,
            "error": err.to_string(),
            "error_class": classify_error_text(&err.to_string()),
        })),
    }
    result
}

fn resolve_prompt(opts: &AiEverrunsOpts) -> Result<String> {
    if !opts.prompt.is_empty() {
        let joined = opts.prompt.join(" ").trim().to_string();
        if joined.is_empty() {
            bail!("prompt is empty");
        };
        return Ok(joined);
    }

    if io::stdin().is_terminal() {
        bail!("missing prompt. Usage: f ai everruns \"your prompt\"");
    }

    let mut buf = String::new();
    io::stdin()
        .read_to_string(&mut buf)
        .context("failed to read prompt from stdin")?;
    let prompt = buf.trim().to_string();
    if prompt.is_empty() {
        bail!("prompt from stdin is empty");
    }
    Ok(prompt)
}

View on GitHub (pinned to a747e741ae)

Solutions

  1. Pass a non-empty quoted prompt as the argument
  2. Check the variable feeding the prompt is actually set and non-blank
  3. Omit the argument entirely to fall back to stdin input instead of passing empty quotes
  4. In scripts, guard with [ -n "$PROMPT" ] before invoking the command

Example fix

// before
f ai everruns "$PROMPT"      # PROMPT=""
// after
PROMPT="summarize the last run"
f ai everruns "$PROMPT"
Defensive patterns

Strategy: validation

Validate before calling

# shell: refuse to invoke with a blank prompt
[ -n "${PROMPT//[[:space:]]/}" ] || { echo "prompt must be non-empty"; exit 1; }
f ai everruns "$PROMPT"

Try / catch

// caller-side: validate before invoking; error is deterministic so no catch needed
let joined = args.join(" ").trim().to_string();
anyhow::ensure!(!joined.is_empty(), "refusing to call `f ai everruns` with a blank prompt");
run_everruns(&joined)?;

Prevention

When it happens

Trigger: Calling `f ai everruns ""` or `f ai everruns " "` — opts.prompt is non-empty as a Vec (so the stdin path is skipped) but the joined, trimmed result is empty.

Common situations: Shell variables expanding to empty (PROMPT="$UNSET"); quoting mistakes passing only whitespace; scripts forwarding an optional prompt arg that was blank; CI templates with an unfilled placeholder.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/5f2bf7027a9dfd10. Report an issue: GitHub.