ajeetdsouza/zoxide · error · ImportError

invalid utf-8

Error message

invalid utf-8

What it means

Error "invalid utf-8" thrown in ajeetdsouza/zoxide.

Source

Thrown at src/import/autojump.rs:42

struct Iter<R: BufRead> {
    reader: R,
    buf: Vec<u8>,
    line_num: usize,
    path: PathBuf,
}

impl<R: BufRead> Iter<R> {
    fn new(reader: R, path: PathBuf) -> Self {
        Self { reader, buf: Vec::new(), line_num: 0, path }
    }

    fn err(&self, source: anyhow::Error) -> ImportError {
        ImportError { path: Some(self.path.clone()), line_num: self.line_num, source }
    }

    fn parse_line(&self, line: &[u8]) -> Result<Dir<'static>, ImportError> {
        let line =
            str::from_utf8(line).map_err(|e| self.err(anyhow!(e).context("invalid utf-8")))?;

        let (rank, path) =
            line.split_once('\t').ok_or_else(|| self.err(anyhow!("invalid entry: {line}")))?;
        let rank = rank
            .parse::<f64>()
            .map_err(|e| self.err(anyhow!(e).context(format!("invalid rank: {rank}"))))?;

        // Normalize the rank using a sigmoid function. Don't import actual ranks from
        // autojump, since its scoring algorithm is very different and might
        // take a while to normalize.
        let rank = sigmoid(rank);

        Ok(Dir { path: Cow::Owned(path.to_string()), rank, last_accessed: 0 })
    }
}

impl<R: BufRead> Iterator for Iter<R> {
    type Item = Result<Dir<'static>, ImportError>;

View on GitHub (pinned to ee594e6906)

When it happens

Trigger: Thrown at src/import/autojump.rs:42 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of ajeetdsouza/zoxide@ee594e6906 (2026-08-16). Data as JSON: /api/errors/9ae9c014cf845fa0. Report an issue: GitHub.