Hmbown/CodeWhale · error · std::io::Error

Ambiguous prefix '{}' matches {} sessions

Error message

Ambiguous prefix '{}' matches {} sessions

What it means

The supplied id prefix matched more than one saved session, so load_session_by_prefix() cannot pick a unique target. Firing protects against silently resuming the wrong session when the prefix is too short to be unambiguous.

Source

Thrown at crates/tui/src/session_manager.rs:1510

            .map(|recovery| recovery.session)
    }

    /// Load a session by partial ID prefix
    pub fn load_session_by_prefix(&self, prefix: &str) -> std::io::Result<SavedSession> {
        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 => self.load_session(&matches[0].id),
            _ => 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();

        for entry in fs::read_dir(&self.sessions_dir)? {
            let entry = entry?;
            let path = entry.path();

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Provide more characters of the session id until it is unique
  2. List sessions and pick the exact id
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/session_manager.rs:1510 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/bcdf7d404215ef57. Report an issue: GitHub.