{"record":{"id":"d704f2cbcacfe795","repo":"astrid-runtime/astrid","slug":"fuse-service-mountpoint-is-not-empty","errorCode":null,"errorMessage":"FUSE service mountpoint is not empty","messagePattern":"FUSE service mountpoint is not empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-fuse/src/service.rs","lineNumber":263,"sourceCode":"        || mountpoint\n            .components()\n            .any(|component| matches!(component, std::path::Component::ParentDir))\n        || mountpoint.parent().is_none()\n    {\n        bail!(\"FUSE service mountpoint is malformed\");\n    }\n    if mountpoint == resource_path\n        || mountpoint.starts_with(resource_path)\n        || resource_path.starts_with(mountpoint)\n    {\n        bail!(\"FUSE service mountpoint overlaps the lease resource\");\n    }\n    platform_fs::validate_private_directory(mountpoint)\n        .context(\"validate private FUSE service mountpoint\")?;\n    platform_fs::verify_no_redirects(mountpoint)\n        .context(\"reject redirected FUSE service mountpoint\")?;\n    if std::fs::read_dir(mountpoint)?.next().is_some() {\n        bail!(\"FUSE service mountpoint is not empty\");\n    }\n    if mountpoint::mountinfo_contains(mountpoint)? {\n        bail!(\"FUSE service mountpoint is already mounted\");\n    }\n    Ok(())\n}\n\nfn validate_control_path(control_path: &Path, resource_path: &Path) -> Result<()> {\n    if !control_path.is_absolute()\n        || control_path\n            .components()\n            .any(|component| matches!(component, std::path::Component::ParentDir))\n    {\n        bail!(\"FUSE service control path is malformed\");\n    }\n    if control_path != resource_path.join(\"process-control.sock\") {\n        bail!(\"FUSE service control path is not the kernel endpoint\");\n    }","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-fuse/src/service.rs#L245-L281","documentation":"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.","triggerScenarios":"Calling validate_launch when the mountpoint directory exists and contains at least one file, subdirectory, or leftover socket.","commonSituations":"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.","solutions":["Empty the mountpoint directory (remove leftover files/sockets) and retry the launch","Clean up after failed launches by deleting the per-launch mount directory instead of reusing it","Use a fresh, per-launch mountpoint path so it is always empty at launch time","Check for a still-registered previous mount and unmount it before relaunching"],"exampleFix":"// before: stale artifacts in mount dir\nrm -rf /run/astrid/mounts/demo && mkdir /run/astrid/mounts/demo\n# or\n\n// after: fresh directory per launch\nlet mountpoint = format!(\"/run/astrid/mounts/{}\", launch_id); // created empty\nstd::fs::create_dir_all(&mountpoint)?;","handlingStrategy":"validation","validationCode":"let empty = std::fs::read_dir(mountpoint).map(|mut d| d.next().is_none())?;\nif !empty { /* clean or pick a fresh mountpoint */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create a fresh mountpoint directory per launch","Clean up mount directories on shutdown and crash paths","Remove artifacts from previously failed launches"],"tags":["fuse","mountpoint","directory-not-empty","stale-state"],"backgroundTag":"directory-not-found","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}