Hmbown/CodeWhale · error
No selection made.
Error message
No selection made.
What it means
`prompt_choice` reads a numeric selection from stdin; an empty line (user pressed Enter without typing, or stdin hit EOF) yields this bail. It guards against an undefined selection rather than defaulting to an option.
Solutions
- Enter the number of the desired option (1-based)
- If input cannot be interactive, run with the corresponding flags and/or --non-interactive
- Check that stdin is connected to a TTY when running interactive setup
Example fix
// before (piped, no input) codewhale remote-setup < /dev/null // after codewhale remote-setup --non-interactive --provider anthropic --cloud aws --bridge discord
Defensive patterns
Strategy: validation
Validate before calling
# only run interactive setup with a TTY
[[ -t 0 ]] || { echo "stdin is not a TTY; use flags + --non-interactive"; exit 2; } Try / catch
match prompt_choice(...) {
Err(e) if e.to_string() == "No selection made." => {
eprintln!("selection required; re-run and enter a 1-based number");
}
other => other?,
} Prevention
- Never pipe stdin from /dev/null when running interactive setup
- Enter a 1-based option number, not the option name
- Prefer flag-based --non-interactive runs in scripts
When it happens
Trigger: Interactive `remote_setup` prompting for cloud/bridge/provider and the user submits an empty line; stdin is closed or `/dev/null` in a piped context so read_line returns empty.
Common situations: Piping the command (`codewhale remote-setup < /dev/null`) which forces an interactive prompt with no input; accidental bare Enter at the prompt.
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
- API key input is unexpectedly large
- API key on stdin exceeds the 8 KiB limit
- external credential consent was not saved: non-interactive…
- interactive key entry requires a terminal; use…
- No patch file provided and stdin is empty.
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/0004a11a170f7674.
Report an issue: GitHub.
Appendix: 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 73e0f67d83)