astrid-runtime/astrid · error

mountpoint is not a directory: {}

Error message

mountpoint is not a directory: {}

What it means

After ensuring the mountpoint exists and contains no symlink redirects, prepare_mountpoint checks that its metadata is a directory. A file, symlink-to-file, or other non-directory at that path triggers "mountpoint is not a directory: {path}" (crates/astrid-storage-provider-fuse/src/mountpoint.rs:39).

Source

Thrown at crates/astrid-storage-provider-fuse/src/mountpoint.rs:39

        };
        std::env::var_os("HOME")
            .map_or_else(|| PathBuf::from("/tmp"), PathBuf::from)
            .join("Astrid")
            .join(leaf)
    });
    if !requested.is_absolute() {
        bail!("mountpoint must be absolute");
    }
    let existed = requested.symlink_metadata().is_ok();
    if !existed {
        std::fs::create_dir_all(&requested)
            .with_context(|| format!("create mountpoint {}", requested.display()))?;
    }
    astrid_core::platform_fs::verify_no_redirects(&requested)
        .with_context(|| format!("reject redirected mountpoint {}", requested.display()))?;
    let metadata = std::fs::symlink_metadata(&requested)?;
    if !metadata.is_dir() {
        bail!("mountpoint is not a directory: {}", requested.display());
    }
    let expected_uid = u32::from(getuid());
    if metadata.uid() != expected_uid {
        bail!(
            "mountpoint must be owned by the current OS user: {}",
            requested.display()
        );
    }
    let mode = metadata.permissions().mode();
    if !existed {
        std::fs::set_permissions(&requested, Permissions::from_mode(0o700))?;
    } else if mode & 0o077 != 0 {
        bail!("mountpoint must be owner-private: {}", requested.display());
    }
    if std::fs::read_dir(&requested)?.next().is_some() {
        bail!("mountpoint is not empty: {}", requested.display());
    }
    let canonical = requested

View on GitHub (pinned to affd8760f4)

Solutions

  1. Remove or rename the file/symlink occupying the mountpoint path, then retry the mount
  2. Choose a different, empty directory path for the mountpoint
  3. Inspect the path with ls -la to confirm what is there before mounting

Example fix

// before
// /home/user/Astrid/vol exists as a regular file
prepare_mountpoint(Path::new("/home/user/Astrid/vol"))?; // bails: not a directory
// after
std::fs::remove_file("/home/user/Astrid/vol")?; // clear the stray file
prepare_mountpoint(Path::new("/home/user/Astrid/vol"))?; // creates the dir
Defensive patterns

Strategy: validation

Validate before calling

let md = std::fs::symlink_metadata(&mp)?; if !md.is_dir() { eprintln!("{} is not a directory", mp.display()); }

Type guard

fn is_directory(p: &std::path::Path) -> bool { std::fs::symlink_metadata(p).map(|m| m.is_dir()).unwrap_or(false) }

Try / catch

match prepare_mountpoint(&mp) { Err(e) if e.to_string().starts_with("mountpoint is not a directory") => { clear_path(&mp)?; prepare_mountpoint(&mp)? }, r => r? }

Prevention

When it happens

Trigger: A regular file or symlink exists at the requested mountpoint path, so symlink_metadata succeeds but is_dir() is false when prepare_mountpoint runs.

Common situations: A previous failed run left a stray file at the mountpoint path; a user created a file where the mount was expected; a symlink pointing to a non-directory target; typo in the mountpoint path colliding with an existing file.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/74e7d059d7413a6c. Report an issue: GitHub.