astrid-runtime/astrid · error

FUSE service mountpoint is not empty

Error message

FUSE service mountpoint is not empty

What it means

validate_mountpoint requires the mountpoint directory to be empty before launching the FUSE service. If std::fs::read_dir yields any entry, the error is thrown because mounting over a non-empty directory would hide existing content and can indicate a previous mount or stray files.

Solutions

  1. Empty the mountpoint directory (remove leftover files/sockets) and retry the launch
  2. Clean up after failed launches by deleting the per-launch mount directory instead of reusing it
  3. Use a fresh, per-launch mountpoint path so it is always empty at launch time
  4. Check for a still-registered previous mount and unmount it before relaunching

Example fix

// before: stale artifacts in mount dir
rm -rf /run/astrid/mounts/demo && mkdir /run/astrid/mounts/demo
# or

// after: fresh directory per launch
let mountpoint = format!("/run/astrid/mounts/{}", launch_id); // created empty
std::fs::create_dir_all(&mountpoint)?;
Defensive patterns

Strategy: validation

Validate before calling

let empty = std::fs::read_dir(mountpoint).map(|mut d| d.next().is_none())?;
if !empty { /* clean or pick a fresh mountpoint */ }

Prevention

When it happens

Trigger: Calling validate_launch when the mountpoint directory exists and contains at least one file, subdirectory, or leftover socket.

Common situations: A previous crashed/unmounted launch left artifacts (e.g. process-control.sock) in the directory; a user placed data in the intended mount folder; a stale control socket was not cleaned up after a failed launch.

Related errors


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

Appendix: source

Thrown at crates/astrid-storage-provider-fuse/src/service.rs:263

        || mountpoint
            .components()
            .any(|component| matches!(component, std::path::Component::ParentDir))
        || mountpoint.parent().is_none()
    {
        bail!("FUSE service mountpoint is malformed");
    }
    if mountpoint == resource_path
        || mountpoint.starts_with(resource_path)
        || resource_path.starts_with(mountpoint)
    {
        bail!("FUSE service mountpoint overlaps the lease resource");
    }
    platform_fs::validate_private_directory(mountpoint)
        .context("validate private FUSE service mountpoint")?;
    platform_fs::verify_no_redirects(mountpoint)
        .context("reject redirected FUSE service mountpoint")?;
    if std::fs::read_dir(mountpoint)?.next().is_some() {
        bail!("FUSE service mountpoint is not empty");
    }
    if mountpoint::mountinfo_contains(mountpoint)? {
        bail!("FUSE service mountpoint is already mounted");
    }
    Ok(())
}

fn validate_control_path(control_path: &Path, resource_path: &Path) -> Result<()> {
    if !control_path.is_absolute()
        || control_path
            .components()
            .any(|component| matches!(component, std::path::Component::ParentDir))
    {
        bail!("FUSE service control path is malformed");
    }
    if control_path != resource_path.join("process-control.sock") {
        bail!("FUSE service control path is not the kernel endpoint");
    }

View on GitHub (pinned to affd8760f4)