astrid-runtime/astrid · error

mountpoint is already registered

Error message

mountpoint is already registered: {}

What it means

mount() registers a MountRecord in the local registry after the kernel grants a lease. Before inserting, it checks whether the mountpoint is already registered and bails to avoid silently overwriting an existing mount record for the same path.

Solutions

  1. Unmount the existing mount at that path before mounting again
  2. Choose a different mountpoint path
  3. If the record is stale, use the stale-mount cleanup/unmount path to remove it first

Example fix

// before
provider.mount("/mnt/share", ...)?; // second call
// after
if !is_mounted("/mnt/share") {
    provider.mount("/mnt/share", ...)?;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// rust
let key = path_key(&mountpoint);
if registry_has_mount(key) { /* unmount first or pick another path */ }

Try / catch

// rust
match provider.mount(&mountpoint, &opts) {
    Ok(lease) => /* use lease */,
    Err(e) if e.to_string().contains("already registered") => {
        provider.unmount(&mountpoint)?;
        provider.mount(&mountpoint, &opts)
    }
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: Calling execute() with a mount request whose mountpoint path (after path_key normalization) matches an existing entry in registry.mounts.

Common situations: Re-running a mount command for an already-mounted path; case/symlink normalization differences making two textual paths map to the same key; a previous mount that was granted but never cleaned up.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


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

Appendix: source

Thrown at crates/astrid-storage-provider-fskit/src/main.rs:185

    client: &mut AdminClient,
    acting_principal: &astrid_core::PrincipalId,
    view: astrid_core::storage_provider::StorageProviderViewV1,
    access: astrid_core::storage_provider::StorageProviderAccessV1,
    requested_mountpoint: Option<PathBuf>,
) -> Result<StorageProviderSuccessV1> {
    let (mountpoint, auto_created) = prepare_mountpoint(requested_mountpoint, &view)?;
    let body = client
        .request(AdminRequestKind::StorageMountIssue {
            view: view.clone(),
            access,
            provider: PROVIDER_NAME.to_owned(),
            mountpoint: mountpoint.clone(),
        })
        .await?;
    let lease = lease_from_response(body)?;
    if let Err(error) = update_registry(|registry| {
        if registry.mounts.contains_key(&path_key(&mountpoint)) {
            bail!("mountpoint is already registered: {}", mountpoint.display());
        }
        registry.mounts.insert(
            path_key(&mountpoint),
            MountRecord {
                mount_id: lease.mount_id,
                requested_by: acting_principal.clone(),
                mountpoint: mountpoint.clone(),
                access,
                auto_created_mountpoint: auto_created,
            },
        );
        Ok(())
    }) {
        revoke_after_registry_failure(client, lease.mount_id).await;
        return match cleanup_created_mountpoint(&mountpoint, auto_created) {
            Err(cleanup) => Err(error.context(cleanup)),
            Ok(()) => Err(error),
        };

View on GitHub (pinned to affd8760f4)