jdx/mise · error

is not a directory; resolve its type before pulling

Error message

{} is not a directory; resolve its type before pulling

What it means

The directories sync module only manages real directories. observe() reads symlink_metadata and returns the (dev, ino, mode) triple only if the path is a directory; if something exists at the path but is not a directory (regular file or symlink), it bails with this error. This catches type conflicts between the live filesystem and what the history tree expects before any mutation happens.

Solutions

  1. Resolve the path type conflict manually: remove or rename the file/symlink at the reported path and recreate the expected directory, then re-run `mise dot sync`.
  2. If the file version is what you want, commit/push the type change first so history matches disk, then pull.
  3. If it's a symlink you intentionally manage outside mise, exclude that path from sync or stop tracking it as a directory in history.
  4. Never let sync run with the conflicting type in place — mise intentionally refuses to guess.

Example fix

// before
$ ls -la ~/.config/foo
.rw-r--r-- foo   # tracked as directory in history
$ mise dot sync
error: ~/.config/foo is not a directory; resolve its type before pulling
// after
$ rm ~/.config/foo && mkdir ~/.config/foo
$ mise dot sync
Defensive patterns

Strategy: validation

Validate before calling

p=~/.config/foo; [ -d "$p" ] && [ ! -L "$p" ] && echo ok || echo "conflict: $p is not a real directory"

Prevention

When it happens

Trigger: A path recorded in history as a directory now exists on disk as a regular file or symlink when observe() runs during plan/validate/apply/verify_written — e.g. `plan`, `Step::validate`, or `Step::verify_written` in directories.rs. The error text tells you to resolve the path's type before pulling.

Common situations: A dotfile that used to be a directory was replaced by a symlink (e.g. to a dotfiles manager target); a tool replaced a directory like ~/.config/foo with a single file; a broken restore created a file where a directory was tracked.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/61bd24c61e5e28cf. Report an issue: GitHub.

Appendix: source

Thrown at src/system/history/sync/directories.rs:23

use crate::system::history::{
    journal, manifest::Manifest, shadow::HistoryRepo, tracked::TrackedSet,
};

#[derive(Clone, Debug)]
pub(super) struct Step {
    pub path: PathBuf,
    before: Option<(u64, u64, u32)>,
    desired: u32,
    written: Option<(u64, u64, u32)>,
}

#[cfg(unix)]
fn observe(path: &std::path::Path) -> Result<Option<(u64, u64, u32)>> {
    use std::os::unix::fs::MetadataExt;
    match std::fs::symlink_metadata(path) {
        Ok(meta) if meta.is_dir() => Ok(Some((meta.dev(), meta.ino(), meta.mode() & 0o777))),
        Ok(_) => bail!(
            "{} is not a directory; resolve its type before pulling",
            crate::file::display_path(path)
        ),
        Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(None),
        Err(err) => Err(err.into()),
    }
}

#[cfg(not(unix))]
fn observe(_path: &std::path::Path) -> Result<Option<(u64, u64, u32)>> {
    Ok(None)
}

pub(super) fn plan(repo: &HistoryRepo, tracked: &TrackedSet, tree: &str) -> Result<Vec<Step>> {
    if !cfg!(unix) {
        return Ok(vec![]);
    }
    let local = repo.ref_oid(HistoryRepo::HISTORY_REF)?;

View on GitHub (pinned to 533346cc37)