Hmbown/CodeWhale · error

No selection made.

Error message

No selection made.

What it means

The interactive prompt_choice helper reads a numbered choice from stdin. When the trimmed input is empty (user pressed Enter on a blank line, or stdin was closed/redirected from an empty source) it bails with 'No selection made.' This fires only in interactive flows; non-interactive mode never reaches the prompt.

Source

Thrown at crates/tui/src/remote_setup/mod.rs:253

// ---------------------------------------------------------------------------
// Prompt helpers (reuse the stdin pattern from main.rs `pick_session_id`)
// ---------------------------------------------------------------------------

/// Print a numbered menu, read a 1-based selection from stdin, return the index.
fn prompt_choice(title: &str, options: &[String]) -> Result<usize> {
    println!();
    println!("{title}:");
    for (idx, opt) in options.iter().enumerate() {
        println!("  {:>2}. {}", idx + 1, opt);
    }
    print!("Enter a number: ");
    io::stdout().flush()?;

    let mut input = String::new();
    io::stdin().read_line(&mut input)?;
    let input = input.trim();
    if input.is_empty() {
        bail!("No selection made.");
    }
    let n: usize = input
        .parse()
        .map_err(|_| anyhow::anyhow!("Invalid input: {input}"))?;
    options
        .get(n.saturating_sub(1))
        .map(|_| n - 1)
        .ok_or_else(|| anyhow::anyhow!("Selection out of range"))
}

/// Generate a runtime token from two random v4 UUIDs (OS CSPRNG via uuid),
/// matching the existing token-generation pattern in this crate.
fn generate_runtime_token() -> String {
    let a = uuid::Uuid::new_v4().simple().to_string();
    let b = uuid::Uuid::new_v4().simple().to_string();
    format!("{a}{b}")
}

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Re-run and enter a number corresponding to one of the listed options.
  2. In automation, always pass --non-interactive plus all required flags so no stdin prompt is attempted.
  3. If stdin is being redirected, ensure the piped input contains a valid line like '1' rather than an empty line.

Example fix

# before
printf '' | codewhale remote-setup   # prompt reads empty input -> No selection made.

# after
codewhale remote-setup --non-interactive --cloud <slug> --bridge <slug> --provider <slug>
Defensive patterns

Strategy: validation

Validate before calling

# Shell: never drive the interactive prompt blindly; either supply stdin or go non-interactive
if [ -t 0 ]; then
  codewhale remote-setup   # interactive terminal, user types choices
else
  codewhale remote-setup --non-interactive --cloud "$CODEWHALE_CLOUD" --bridge "$CODEWHALE_BRIDGE" --provider "$CODEWHALE_PROVIDER"
fi

Prevention

When it happens

Trigger: Pressing Enter without typing a number at any 'Enter a number:' prompt in remote setup (cloud target, bridge, provider selection); piping an empty line or /dev/null into the command while running it without --non-interactive; a crashed terminal that closes stdin mid-prompt.

Common situations: Users hit Enter hoping for a default; scripts drive the interactive path with empty stdin; CI accidentally omits --non-interactive so the process prompts into a pipe that immediately EOFs or yields blank lines.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/0004a11a170f7674. Report an issue: GitHub.