{"record":{"id":"61bd24c61e5e28cf","repo":"jdx/mise","slug":"is-not-a-directory-resolve-its-type-before-pul","errorCode":null,"errorMessage":"{} is not a directory; resolve its type before pulling","messagePattern":"(.+?) is not a directory; resolve its type before pulling","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/directories.rs","lineNumber":23,"sourceCode":"\nuse crate::system::history::{\n    journal, manifest::Manifest, shadow::HistoryRepo, tracked::TrackedSet,\n};\n\n#[derive(Clone, Debug)]\npub(super) struct Step {\n    pub path: PathBuf,\n    before: Option<(u64, u64, u32)>,\n    desired: u32,\n    written: Option<(u64, u64, u32)>,\n}\n\n#[cfg(unix)]\nfn observe(path: &std::path::Path) -> Result<Option<(u64, u64, u32)>> {\n    use std::os::unix::fs::MetadataExt;\n    match std::fs::symlink_metadata(path) {\n        Ok(meta) if meta.is_dir() => Ok(Some((meta.dev(), meta.ino(), meta.mode() & 0o777))),\n        Ok(_) => bail!(\n            \"{} is not a directory; resolve its type before pulling\",\n            crate::file::display_path(path)\n        ),\n        Err(err) if err.kind() == std::io::ErrorKind::NotFound => Ok(None),\n        Err(err) => Err(err.into()),\n    }\n}\n\n#[cfg(not(unix))]\nfn observe(_path: &std::path::Path) -> Result<Option<(u64, u64, u32)>> {\n    Ok(None)\n}\n\npub(super) fn plan(repo: &HistoryRepo, tracked: &TrackedSet, tree: &str) -> Result<Vec<Step>> {\n    if !cfg!(unix) {\n        return Ok(vec![]);\n    }\n    let local = repo.ref_oid(HistoryRepo::HISTORY_REF)?;","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/directories.rs#L5-L41","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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`.","If the file version is what you want, commit/push the type change first so history matches disk, then pull.","If it's a symlink you intentionally manage outside mise, exclude that path from sync or stop tracking it as a directory in history.","Never let sync run with the conflicting type in place — mise intentionally refuses to guess."],"exampleFix":"// before\n$ ls -la ~/.config/foo\n.rw-r--r-- foo   # tracked as directory in history\n$ mise dot sync\nerror: ~/.config/foo is not a directory; resolve its type before pulling\n// after\n$ rm ~/.config/foo && mkdir ~/.config/foo\n$ mise dot sync","handlingStrategy":"validation","validationCode":"p=~/.config/foo; [ -d \"$p\" ] && [ ! -L \"$p\" ] && echo ok || echo \"conflict: $p is not a real directory\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Before pulling, ensure paths tracked as directories exist as real directories (not files/symlinks).","When switching a tracked path's type, commit the type change first so history matches disk.","Audit symlink-heavy setups (stow, dotbot) for paths mise tracks as directories."],"tags":["filesystem","type-mismatch","sync","directories"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}