{"record":{"id":"a399fd6ef1bcd398","repo":"nikivdev/code","slug":"session-not-found-a399fd","errorCode":null,"errorMessage":"Session not found","messagePattern":"Session not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/ai.rs","lineNumber":15611,"sourceCode":"            writeln!(stdin, \"{}\", display)?;\n        }\n    }\n\n    let output = child.wait_with_output()?;\n    if !output.status.success() {\n        return Ok(());\n    }\n\n    let selection = String::from_utf8(output.stdout).context(\"fzf output was not valid UTF-8\")?;\n    let selection = selection.trim();\n\n    if selection.is_empty() {\n        return Ok(());\n    }\n\n    // Find selected session\n    let Some((_, session)) = entries.iter().find(|(d, _)| d == selection) else {\n        bail!(\"Session not found\");\n    };\n\n    // Get context since last consumed checkpoint (or full if --full)\n    let context = get_cross_project_context(session, opts.count, opts.full)?;\n\n    if context.is_empty() {\n        if opts.full {\n            println!(\"No context found in session.\");\n        } else {\n            println!(\"No new context since last consumption. Use --full for entire session.\");\n        }\n        return Ok(());\n    }\n\n    let output = if opts.handoff {\n        summarize_handoff_with_gemini(&context)?\n    } else {\n        context","sourceCodeStart":15593,"sourceCodeEnd":15629,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/ai.rs#L15593-L15629","documentation":"Thrown by the interactive cross-project session picker: the user selected (or the input resolved to) a display string that does not match any directory entry in the entries list, so the find() over entries fails. It is a guard that the chosen selection corresponds to a real stored session directory before loading its context.","triggerScenarios":"The selection prompt returns an empty-matched non-empty string — e.g. stale entries listed, user typing a custom value into a fuzzy/select prompt, or entries mutated between listing and selection so the chosen display string no longer matches.","commonSituations":"Sessions were deleted by another process between listing and selection; custom prompt input that isn't an exact directory name; unicode/whitespace differences between displayed label and the underlying directory name.","solutions":["Re-run the picker command so the entry list is refreshed and select from the fresh list","Select an entry from the list rather than typing free-form input","Verify the cross-project sessions directory still exists and contains session folders","Clear stale session directories and regenerate the list"],"exampleFix":"// before\nf ai context --pick   # picks stale entry deleted earlier\n// after\nrm -rf stale-session-dir; f ai context --pick   # fresh listing, valid selection","handlingStrategy":"validation","validationCode":"# shell: refresh listing immediately before selecting, and match exactly\nentries=$(ls \"${CROSS_PROJECT_DIR:?}\")\ngrep -Fxq \"$SELECTION\" <<<\"$entries\" || { echo \"selection not in current list\"; exit 1; }","typeGuard":null,"tryCatchPattern":"// re-list and retry once when selection misses\nmatch pick_and_load() {\n    Err(e) if e.to_string() == \"Session not found\" => {\n        refresh_entries();\n        pick_and_load().context(\"selection stale after re-list\")\n    }\n    other => other,\n}","preventionTips":["Always select from the freshly rendered list, never type free-form","Avoid concurrent processes deleting sessions while a picker is open","Regenerate the session list after any manual directory cleanup","Watch for whitespace/unicode differences in displayed labels"],"tags":["session","selection","not-found","interactive"],"backgroundTag":"session-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}