{"record":{"id":"58e2daa5d45e49ba","repo":"Hmbown/CodeWhale","slug":"no-session-selected-58e2da","errorCode":null,"errorMessage":"No session selected.","messagePattern":"No session selected\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"crates/tui/src/lib.rs","lineNumber":7917,"sourceCode":"fn pick_session_id() -> Result<String> {\n    let manager = SessionManager::default_location()?;\n    let sessions = manager.list_sessions()?;\n    if sessions.is_empty() {\n        bail!(\"No saved sessions found.\");\n    }\n\n    println!(\"Select a session to resume:\");\n    for (idx, session) in sessions.iter().enumerate() {\n        println!(\"  {:>2}. {} ({})\", idx + 1, session.title, session.id);\n    }\n    print!(\"Enter a number (or press Enter to cancel): \");\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 session selected.\");\n    }\n    let idx: usize = input\n        .parse()\n        .map_err(|_| anyhow::anyhow!(\"Invalid input\"))?;\n    let session = sessions\n        .get(idx.saturating_sub(1))\n        .ok_or_else(|| anyhow::anyhow!(\"Selection out of range\"))?;\n    Ok(session.id.clone())\n}\n\nasync fn run_review(config: &Config, args: ReviewArgs) -> Result<()> {\n    use crate::client::DeepSeekClient;\n\n    let diff = collect_diff(&args)?;\n    if diff.trim().is_empty() {\n        bail!(\"No diff to review.\");\n    }\n    validate_review_receipt_args(&args)?;","sourceCodeStart":7899,"sourceCodeEnd":7935,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/lib.rs#L7899-L7935","documentation":"The session picker prints a numbered list and reads a line; submitting an empty line bails with \"No session selected.\" rather than picking a default. It exits non-zero like any anyhow failure, but semantically it is a user cancellation, not a fault. Adjacent outcomes are \"Invalid input\" (non-numeric) and \"Selection out of range\".","triggerScenarios":"Running the interactive picker and pressing Enter without typing anything (input.trim().is_empty()). Also hit when blank lines are piped into the prompt.","commonSituations":"Users backing out of the picker; scripts that invoke the interactive command without a tty input strategy; automation piping empty input.","solutions":["Type a listed number and press Enter, or re-run with an explicit session id to skip the picker","In wrappers, classify this specific message as a clean cancellation (exit 0)","Avoid piping blank lines into interactive pickers"],"exampleFix":"// before: scripts die on a benign cancel\n$ codewhale resume; echo $?\nError: No session selected.  (exit 1)\n\n// after: treat the cancel message as success\n$ codewhale resume 2>err || { grep -q 'No session selected.' err && exit 0; cat err >&2; exit 1; }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"codewhale resume 2>/tmp/pick.err || {\n  if grep -q 'No session selected.' /tmp/pick.err; then exit 0; fi  # user cancel\n  cat /tmp/pick.err >&2; exit 1\n}","preventionTips":["Pass explicit session ids in automation to bypass interactive prompts entirely","Classify 'No session selected.' as cancellation, distinct from 'Invalid input' / 'Selection out of range'"],"tags":["sessions","interactive","user-cancellation","picker"],"backgroundTag":"user-cancelled-input","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}