{"record":{"id":"0004a11a170f7674","repo":"Hmbown/CodeWhale","slug":"no-selection-made","errorCode":null,"errorMessage":"No selection made.","messagePattern":"No selection made\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/remote_setup/mod.rs","lineNumber":253,"sourceCode":"// ---------------------------------------------------------------------------\n// Prompt helpers (reuse the stdin pattern from main.rs `pick_session_id`)\n// ---------------------------------------------------------------------------\n\n/// Print a numbered menu, read a 1-based selection from stdin, return the index.\nfn prompt_choice(title: &str, options: &[String]) -> Result<usize> {\n    println!();\n    println!(\"{title}:\");\n    for (idx, opt) in options.iter().enumerate() {\n        println!(\"  {:>2}. {}\", idx + 1, opt);\n    }\n    print!(\"Enter a number: \");\n    io::stdout().flush()?;\n\n    let mut input = String::new();\n    io::stdin().read_line(&mut input)?;\n    let input = input.trim();\n    if input.is_empty() {\n        bail!(\"No selection made.\");\n    }\n    let n: usize = input\n        .parse()\n        .map_err(|_| anyhow::anyhow!(\"Invalid input: {input}\"))?;\n    options\n        .get(n.saturating_sub(1))\n        .map(|_| n - 1)\n        .ok_or_else(|| anyhow::anyhow!(\"Selection out of range\"))\n}\n\n/// Generate a runtime token from two random v4 UUIDs (OS CSPRNG via uuid),\n/// matching the existing token-generation pattern in this crate.\nfn generate_runtime_token() -> String {\n    let a = uuid::Uuid::new_v4().simple().to_string();\n    let b = uuid::Uuid::new_v4().simple().to_string();\n    format!(\"{a}{b}\")\n}\n","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/remote_setup/mod.rs#L235-L271","documentation":"`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.","triggerScenarios":"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.","commonSituations":"Piping the command (`codewhale remote-setup < /dev/null`) which forces an interactive prompt with no input; accidental bare Enter at the prompt.","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"],"exampleFix":"// before (piped, no input)\ncodewhale remote-setup < /dev/null\n// after\ncodewhale remote-setup --non-interactive --provider anthropic --cloud aws --bridge discord","handlingStrategy":"validation","validationCode":"# only run interactive setup with a TTY\n[[ -t 0 ]] || { echo \"stdin is not a TTY; use flags + --non-interactive\"; exit 2; }","typeGuard":null,"tryCatchPattern":"match prompt_choice(...) {\n    Err(e) if e.to_string() == \"No selection made.\" => {\n        eprintln!(\"selection required; re-run and enter a 1-based number\");\n    }\n    other => other?,\n}","preventionTips":["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"],"tags":["cli","interactive-prompt","stdin"],"backgroundTag":"missing-required-argument","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}