{"record":{"id":"418f6cbb06dcbdad","repo":"astrid-runtime/astrid","slug":"build-winfsp-callback-filesystem-failure","errorCode":null,"errorMessage":"build WinFsp callback filesystem: {failure:?}","messagePattern":"build WinFsp callback filesystem: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-winfsp/src/win.rs","lineNumber":75,"sourceCode":"        bail!(\"WinFsp daemon lease exceeds limit\");\n    }\n    let start: DaemonStart =\n        serde_json::from_slice(&bytes).context(\"decode WinFsp daemon lease\")?;\n    let lease = start.lease;\n    if (!start.mountpoint.is_absolute() && !is_drive_designator(&start.mountpoint))\n        || !lease.callback_path.is_absolute()\n    {\n        bail!(\"WinFsp daemon lease contains a relative endpoint\");\n    }\n\n    let runtime = Arc::new(\n        tokio::runtime::Builder::new_multi_thread()\n            .enable_all()\n            .build()\n            .context(\"start WinFsp callback runtime\")?,\n    );\n    let callback = CallbackFs::new(lease.clone(), Arc::clone(&runtime))\n        .map_err(|failure| anyhow::anyhow!(\"build WinFsp callback filesystem: {failure:?}\"))?;\n    let control_path = provider_control_path(&lease.mount_id)?;\n    let control_listener = local_transport::bind(&control_path)\n        .with_context(|| format!(\"bind WinFsp control endpoint {}\", control_path.display()))?;\n    initialize_winfsp()?;\n    let mountpoint = U16CString::from_os_str(start.mountpoint.as_os_str())\n        .map_err(|_| anyhow::anyhow!(\"mountpoint is not valid UTF-16\"))?;\n    let filesystem = FileSystem::start(volume_params(lease.access), Some(&mountpoint), callback)\n        .map_err(|status| {\n            anyhow::anyhow!(\"WinFsp failed to start mount with status {status:#x}\")\n        })?;\n    wait_for_mountpoint_ready(&start.mountpoint)?;\n\n    let mut stdout = std::io::stdout().lock();\n    writeln!(stdout, \"READY {0}\", lease.mount_id).context(\"report WinFsp readiness\")?;\n    stdout.flush().context(\"flush WinFsp readiness\")?;\n\n    let result = runtime.block_on(daemon_loop(filesystem, control_listener));\n    if let Err(error) = result {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-winfsp/src/win.rs#L57-L93","documentation":"In the WinFsp daemon entrypoint, CallbackFs::new constructs the filesystem callback object from the mount lease and tokio runtime. If construction fails, the debug representation of the failure is wrapped in this anyhow error and the daemon aborts before initializing WinFsp.","triggerScenarios":"CallbackFs::new returns Err — e.g. the StorageMountLeaseV1 contains invalid or missing fields, runtime state cannot be captured, or lease validation inside CallbackFs fails.","commonSituations":"A malformed or partially populated mount lease handed to the daemon; version skew between the parent process and daemon binary producing incompatible lease formats; lease deserialized from a stale registry record.","solutions":["Inspect the {failure:?} payload in the message for the inner cause","Validate the mount lease contents before spawning the daemon","Ensure the daemon binary and caller are the same version (lease schema match)","Regenerate the lease rather than reusing a stale one from the registry"],"exampleFix":"// before: only Debug of failure\n.map_err(|failure| anyhow::anyhow!(\"build WinFsp callback filesystem: {failure:?}\"))?;\n// after: keep error chain\n.map_err(|failure| anyhow::anyhow!(\"build WinFsp callback filesystem: {failure:?}\"))\n    .with_context(|| format!(\"mount_id: {}\", lease.mount_id))?;","handlingStrategy":"validation","validationCode":"// validate the lease fields CallbackFs depends on before spawning the daemon\nif lease.mount_id.is_empty() || lease.access.is_none() {\n    return Err(\"incomplete mount lease\");\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"build WinFsp callback filesystem\") => {\n        // parse inner failure:? and regenerate the lease before retry\n    }\n    r => r,\n}","preventionTips":["Validate the lease before handing it to the daemon","Keep caller and daemon binaries on the same version","Never reuse stale registry leases; regenerate per mount","Log the inner failure payload for triage"],"tags":["winfsp","windows","daemon","filesystem-init"],"backgroundTag":"module-init-failed","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"}