zeroclaw-labs/zeroclaw · error · anyhow::Error

cli-secret-empty

cli-secret-empty

Error message

Value cannot be empty.

What it means

After collecting the hidden value in secret_prompt, an empty or whitespace-only result is rejected unless the specific call site passed allow_empty (only done where an empty secret is a meaningful choice). This is the last-chance check that a required secret was actually entered (i18n key 'cli-secret-empty').

Source

Thrown at src/main.rs:164

#[cfg(feature = "agent-runtime")]
fn secret_prompt(prompt_text: &str, allow_empty: bool) -> Result<String> {
    use std::io::IsTerminal;

    if !std::io::stdin().is_terminal() || !std::io::stderr().is_terminal() {
        bail!(ta(
            "cli-secret-needs-tty",
            &[],
            "Secret input requires a terminal on stdin and stderr."
        ));
    }

    let value = cli_input::SecretInput::new()
        .with_prompt(prompt_text)
        .interact()?;
    if allow_empty || !value.trim().is_empty() {
        Ok(value)
    } else {
        bail!(ta("cli-secret-empty", &[], "Value cannot be empty."))
    }
}

#[cfg(feature = "agent-runtime")]
fn qta(key: &str, args: &[(&str, &str)]) -> String {
    zeroclaw_runtime::i18n::get_required_cli_string_with_args(key, args)
}

#[cfg(feature = "agent-runtime")]
fn quickstart_row(key: &str, glyph: &str, summary: &str) -> String {
    qta(key, &[("glyph", glyph), ("summary", summary)])
}

#[cfg(feature = "agent-runtime")]
fn quickstart_step_label(step: zeroclaw_runtime::quickstart::QuickstartStep) -> String {
    t(step.label_key(), step.label())
}

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Re-run the command and enter a non-empty value at the prompt (leading/trailing whitespace alone does not count).
  2. Verify the paste actually landed by checking the prompt's mask/feedback before submitting.
  3. If you legitimately need no secret for that flow, use the flow's documented skip/unset option instead of submitting empty input.
Defensive patterns

Strategy: validation

Try / catch

match secret_prompt("API key:", false) {
    Err(e) if e.to_string().contains("cannot be empty") => {
        // re-prompt the user; a required secret was submitted blank
    }
    other => other,
}

Prevention

When it happens

Trigger: Pressing Enter at a secret prompt without typing anything, or a paste that put only whitespace into the buffer, on a prompt created with allow_empty=false.

Common situations: Users skipping a prompt to 'see what happens'; clipboard paste failing silently; terminal input quirks swallowing the pasted value so the user submits empty.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/e12c93ef20e43eb4. Report an issue: GitHub.