astrid-runtime/astrid · error

mountpoint is already registered: {}

Error message

mountpoint is already registered: {}

What it means

Before requesting a mount lease from the admin service, mount() computes the prepared mountpoint's registry key and checks the local mount registry. If a mount already occupies that mountpoint path, it bails rather than double-registering.

Source

Thrown at crates/astrid-storage-provider-winfsp/src/main.rs:189

            })
        },
        StorageProviderOperationV1::Unmount { selector } => {
            unmount(&mut client, &acting_principal, &selector).await
        },
    }
}

async fn mount(
    client: &mut AdminClient,
    acting_principal: PrincipalId,
    view: astrid_core::storage_provider::StorageProviderViewV1,
    access: StorageProviderAccessV1,
    requested: Option<PathBuf>,
) -> Result<StorageProviderSuccessV1> {
    let (mountpoint, auto_created) = prepare_mountpoint(requested, &view)?;
    let registry_key = path_key(&mountpoint)?;
    if load_registry()?.mounts.contains_key(&registry_key) {
        bail!("mountpoint is already registered: {}", mountpoint.display());
    }
    let body = client
        .request(AdminRequestKind::StorageMountIssue {
            view,
            access,
            provider: PROVIDER_NAME.to_owned(),
            mountpoint: mountpoint.clone(),
        })
        .await?;
    let lease = lease_from_response(body)?;
    let control_path = provider_control_path(&lease.mount_id)?;

    if let Err(error) = native_mount(&lease, &mountpoint).await {
        revoke_after_native_failure(client, &lease, auto_created, &mountpoint).await;
        return Err(error);
    }
    let registered = update_registry(|registry| {
        if registry.mounts.contains_key(&registry_key) {

View on GitHub (pinned to affd8760f4)

Solutions

  1. Unmount the existing mount on that path first (or remove the stale registry entry if the mount is already gone).
  2. Request a different mountpoint path / drive letter via the `requested` argument.
  3. Inspect the registry file for stale entries left by crashed runs and clean them up.
  4. Ensure the previous unmount completed successfully before remounting the same path.

Example fix

// before: remounting the same path fails
client_mount("Z:", view, access)?;
// after: release the existing mount first
if registry_has_mount("Z:") {
    unmount(selector_for("Z:", principal)).await?;
}
client_mount("Z:", view, access)?;
Defensive patterns

Strategy: validation

Validate before calling

// Before requesting the mount:
let key = path_key(&PathBuf::from("Z:"))?;
if registry_file_contains(&key) {
    // unmount first or choose another path
}

Try / catch

// Caller
match mount(client, view, access, Some(path)).await {
    Err(e) if e.to_string().starts_with("mountpoint is already registered") => {
        // unmount existing record or pick a different mountpoint
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling execute(StorageMount...) when load_registry()?.mounts already contains an entry for the key of the mountpoint produced by prepare_mountpoint() — i.e. a previous mount on the same path was never unmounted or removed from the registry.

Common situations: A previous provider run crashed after mounting without cleaning the registry; the same drive letter/path is requested twice; auto-created mountpoints collide with an existing registration; manual registry edits left stale entries.

Related errors


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