{"record":{"id":"526c12cb70cba5d5","repo":"astrid-runtime/astrid","slug":"mountpoint-was-concurrently-registered","errorCode":null,"errorMessage":"mountpoint was concurrently registered: {}","messagePattern":"mountpoint was concurrently registered: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-winfsp/src/main.rs","lineNumber":208,"sourceCode":"    }\n    let body = client\n        .request(AdminRequestKind::StorageMountIssue {\n            view,\n            access,\n            provider: PROVIDER_NAME.to_owned(),\n            mountpoint: mountpoint.clone(),\n        })\n        .await?;\n    let lease = lease_from_response(body)?;\n    let control_path = provider_control_path(&lease.mount_id)?;\n\n    if let Err(error) = native_mount(&lease, &mountpoint).await {\n        revoke_after_native_failure(client, &lease, auto_created, &mountpoint).await;\n        return Err(error);\n    }\n    let registered = update_registry(|registry| {\n        if registry.mounts.contains_key(&registry_key) {\n            bail!(\n                \"mountpoint was concurrently registered: {}\",\n                mountpoint.display()\n            );\n        }\n        registry.mounts.insert(\n            registry_key.clone(),\n            MountRecord {\n                mount_id: lease.mount_id,\n                requested_by: acting_principal,\n                mountpoint: mountpoint.clone(),\n                resource_path: lease.resource_path.clone(),\n                control_path: control_path.clone(),\n                access,\n                auto_created_mountpoint: auto_created,\n            },\n        );\n        Ok(())\n    });","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-winfsp/src/main.rs#L190-L226","documentation":"After the native WinFsp mount succeeded, mount() performs a final registry update under its own check-and-insert. If another process inserted the same registry key between the initial check and this update, the mount would be double-booked, so the update bails with this error.","triggerScenarios":"Two provider processes race to mount the same mountpoint: both pass the initial load_registry() check (716), both complete native_mount(), and the loser's update_registry() finds the key already inserted by the winner.","commonSituations":"Multiple mount requests for the same drive letter issued concurrently by parallel tooling or CI; several provider instances sharing one registry file without external locking; a retried mount launched while the original attempt is still finishing.","solutions":["Serialize mount operations for a given path — use an external lock or single mount orchestrator.","Unmount the newly created native mount before retrying, since this error is raised after native_mount already succeeded.","Retry with a different mountpoint path to avoid the collision.","Check which other process owns the registry entry (its requested_by principal) and coordinate with it."],"exampleFix":"// before: parallel mounts of the same path race\njoin_all(paths.iter().map(|p| mount(p, view, access))).await;\n// after: serialize per-path with a lock\nlet _guard = path_lock(\"Z:\").lock().await;\nmount(\"Z:\", view, access).await?;","handlingStrategy":"retry","validationCode":"// Prevent the race externally before launching parallel mounts:\nlet _guard = path_lock(mountpoint).lock().await; // serialize per-path","typeGuard":null,"tryCatchPattern":"// Caller\nmatch mount(client, view, access, Some(path)).await {\n    Err(e) if e.to_string().starts_with(\"mountpoint was concurrently registered\") => {\n        // NOTE: native mount already succeeded; unmount it, then retry on another path\n    }\n    other => other?,\n}","preventionTips":["Serialize mounts per path with a lock or single orchestrator","Avoid retrying a mount while the previous attempt is still in flight","Run only one provider instance per registry file"],"tags":["winfsp","race-condition","mount","concurrency"],"backgroundTag":"address-already-in-use","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}