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/z.rs:42
pub(crate) struct Iter<R: BufRead> {
reader: R,
buf: Vec<u8>,
line_num: usize,
path: PathBuf,
}
impl<R: BufRead> Iter<R> {
pub(crate) 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 err = || self.err(anyhow!("invalid entry: {line}"));
// z stores entries as `path|rank|last_accessed`. Use `rsplitn` so paths
// containing `|` are preserved.
let mut split = line.rsplitn(3, '|');
let last_accessed = split.next().ok_or_else(err)?;
let last_accessed = last_accessed.parse::<u64>().map_err(|_| err())?;
let rank = split.next().ok_or_else(err)?;
let rank = rank.parse::<f64>().map_err(|_| err())?;
let path = split.next().ok_or_else(err)?;
Ok(Dir { path: Cow::Owned(path.to_string()), rank, last_accessed })
}
}
View on GitHub (pinned to ee594e6906)
When it happens
Trigger: Thrown at src/import/z.rs:42 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of ajeetdsouza/zoxide@ee594e6906 (2026-08-16).
Data as JSON: /api/errors/91289ed012306577.
Report an issue: GitHub.