{"record":{"id":"ce665d700c689b35","repo":"Hmbown/CodeWhale","slug":"no-session-found-with-prefix","errorCode":null,"errorMessage":"No session found with prefix: {}","messagePattern":"No session found with prefix: (.+?)","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/session_manager.rs","lineNumber":2494,"sourceCode":"            .map(|recovery| recovery.session)\n    }\n\n    /// Load a session by partial ID prefix\n    pub fn load_session_by_prefix(&self, prefix: &str) -> std::io::Result<SavedSession> {\n        self.load_session(&self.resolve_session_id_prefix(prefix)?)\n    }\n\n    /// Resolve a unique ID without applying resume-time repair to its record.\n    pub(crate) fn resolve_session_id_prefix(&self, prefix: &str) -> std::io::Result<String> {\n        let sessions = self.list_sessions()?;\n\n        let matches: Vec<_> = sessions\n            .into_iter()\n            .filter(|s| s.id.starts_with(prefix))\n            .collect();\n\n        match matches.len() {\n            0 => Err(std::io::Error::new(\n                std::io::ErrorKind::NotFound,\n                format!(\"No session found with prefix: {prefix}\"),\n            )),\n            1 => Ok(matches[0].id.clone()),\n            _ => Err(std::io::Error::new(\n                std::io::ErrorKind::InvalidInput,\n                format!(\n                    \"Ambiguous prefix '{}' matches {} sessions\",\n                    prefix,\n                    matches.len()\n                ),\n            )),\n        }\n    }\n\n    /// List all saved sessions, sorted by most recently updated\n    pub fn list_sessions(&self) -> std::io::Result<Vec<SessionMetadata>> {\n        let mut sessions = Vec::new();","sourceCodeStart":2476,"sourceCodeEnd":2512,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/session_manager.rs#L2476-L2512","documentation":"Session-id prefix resolution filters all stored sessions by id.starts_with(prefix) and requires exactly one match; zero matches yields a NotFound io::Error. The library throws this so partial-id resume/pick operations fail loudly instead of guessing.","triggerScenarios":"Calling the prefix-resolution API (used by resume/continue flows) with a prefix that matches no stored session id — a typo, a stale id from a deleted session, or copying only part of an unrelated id.","commonSituations":"Typing a shorthand id in the picker or CLI, referencing a session that was deleted, or using an id from another machine/profile directory.","solutions":["List available sessions and copy an exact id or a longer, correct prefix.","Check that you are pointed at the right session storage directory/profile; ids are per-store.","Recreate the session if it was deleted — the old id no longer exists."],"exampleFix":"// before\nlet id = manager.resolve_session_prefix(\"ab1\")?;\n// after\nlet id = match manager.resolve_session_prefix(\"ab1\") {\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound => {\n        eprintln!(\"no session matches 'ab1'; available: {:?}\", manager.list_sessions()?);\n        return Err(e);\n    }\n    other => other?,\n};","handlingStrategy":"validation","validationCode":"fn unique_prefix_ok(prefix: &str, sessions: &[SessionInfo]) -> bool {\n    let n = sessions.iter().filter(|s| s.id.starts_with(prefix)).count();\n    n == 1\n}","typeGuard":null,"tryCatchPattern":"match resolve_session_prefix(prefix) {\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound => {\n        eprintln!(\"no session matches '{prefix}'; list sessions and retry\");\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Copy full session ids from the picker instead of typing short prefixes.","Check the session store directory/profile before assuming an id exists.","Don't reuse prefixes from deleted sessions; ids don't resurrect."],"tags":["session-id","prefix-lookup","not-found","cli"],"backgroundTag":"resource-not-found","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"}