Hmbown/CodeWhale · error · io::Error
No session found with prefix
Error message
No session found with prefix: {} What it means
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.
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.
Example fix
// before
let id = manager.resolve_session_prefix("ab1")?;
// after
let id = match manager.resolve_session_prefix("ab1") {
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
eprintln!("no session matches 'ab1'; available: {:?}", manager.list_sessions()?);
return Err(e);
}
other => other?,
}; Defensive patterns
Strategy: validation
Validate before calling
fn unique_prefix_ok(prefix: &str, sessions: &[SessionInfo]) -> bool {
let n = sessions.iter().filter(|s| s.id.starts_with(prefix)).count();
n == 1
} Try / catch
match resolve_session_prefix(prefix) {
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
eprintln!("no session matches '{prefix}'; list sessions and retry");
Err(e)
}
other => other,
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Typing a shorthand id in the picker or CLI, referencing a session that was deleted, or using an id from another machine/profile directory.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Ambiguous prefix ' ' matches sessions
- MCP server ' ' not found
- Task not found
- A positive pull request number is required
- account_agent_model_unconfigured
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/ce665d700c689b35.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/session_manager.rs:2494
.map(|recovery| recovery.session)
}
/// Load a session by partial ID prefix
pub fn load_session_by_prefix(&self, prefix: &str) -> std::io::Result<SavedSession> {
self.load_session(&self.resolve_session_id_prefix(prefix)?)
}
/// Resolve a unique ID without applying resume-time repair to its record.
pub(crate) fn resolve_session_id_prefix(&self, prefix: &str) -> std::io::Result<String> {
let sessions = self.list_sessions()?;
let matches: Vec<_> = sessions
.into_iter()
.filter(|s| s.id.starts_with(prefix))
.collect();
match matches.len() {
0 => Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
format!("No session found with prefix: {prefix}"),
)),
1 => Ok(matches[0].id.clone()),
_ => Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!(
"Ambiguous prefix '{}' matches {} sessions",
prefix,
matches.len()
),
)),
}
}
/// List all saved sessions, sorted by most recently updated
pub fn list_sessions(&self) -> std::io::Result<Vec<SessionMetadata>> {
let mut sessions = Vec::new();View on GitHub (pinned to 73e0f67d83)