ajeetdsouza/zoxide · error · anyhow::Error

not a directory: {path}

Error message

not a directory: {path}

What it means

Error "not a directory: {path}" thrown in ajeetdsouza/zoxide.

Source

Thrown at src/cmd/add.rs:34

        let max_age = config::maxage()?;
        let now = util::current_time()?;

        let mut db = Database::open()?;

        for path in &self.paths {
            let path =
                if config::resolve_symlinks() { util::canonicalize } else { util::resolve_path }(
                    path,
                )?;
            let path = util::path_to_str(&path)?;

            // Ignore path if it contains unsupported characters, or if it's in the exclude
            // list.
            if path.contains(EXCLUDE_CHARS) || exclude_dirs.iter().any(|glob| glob.matches(path)) {
                continue;
            }
            if !Path::new(path).is_dir() {
                bail!("not a directory: {path}");
            }

            let by = self.score.unwrap_or(1.0);
            db.add_update(path, by, now);
        }

        if db.dirty() {
            db.age(max_age);
        }
        db.save()
    }
}

View on GitHub (pinned to 8a3f76da90)

Solutions

  1. Pass a path to a directory, not a regular file
  2. Check the path with 'ls -ld <path>' and correct it

When it happens

Trigger: Thrown at src/cmd/add.rs:34 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ajeetdsouza/zoxide@8a3f76da90 (2026-08-19). Data as JSON: /api/errors/d9d1b7c4ebca306b. Report an issue: GitHub.