{"record":{"id":"8fe15af5f71c51b2","repo":"xai-org/grok-build","slug":"overlay-unmount-delegation-not-supported-by-this-d","errorCode":null,"errorMessage":"overlay unmount delegation not supported by this delegate","messagePattern":"overlay unmount delegation not supported by this delegate","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-fast-worktree/src/api.rs","lineNumber":85,"sourceCode":"    fn delete_snapshot(&self, worktree_path: &Path) -> Result<RemoveReport>;\n\n    /// Mount an overlayfs at `target` in the *caller's* mount namespace.\n    ///\n    /// A FUSE+overlay worktree needs a new overlay mount, which a rootless\n    /// caller can't do (no `CAP_SYS_ADMIN`); the privileged delegate mounts it\n    /// inside the caller's namespace (an overlay mount can't be exposed via a\n    /// namespace-crossing symlink the way a btrfs snapshot can). Default impl\n    /// errors so btrfs-only delegates still compile.\n    fn mount_overlay(&self, lower: &Path, upper: &Path, work: &Path, target: &Path) -> Result<()> {\n        let _ = (lower, upper, work, target);\n        anyhow::bail!(\"overlay mount delegation not supported by this delegate\")\n    }\n\n    /// Unmount an overlay worktree previously mounted via [`Self::mount_overlay`]\n    /// (in the caller's mount namespace).\n    fn unmount_overlay(&self, target: &Path) -> Result<()> {\n        let _ = target;\n        anyhow::bail!(\"overlay unmount delegation not supported by this delegate\")\n    }\n}\n\n/// How to treat the source working tree when creating the destination worktree.\n#[derive(Clone, Debug, Default, Eq, PartialEq)]\npub enum WorkingTreeMode {\n    /// Replicate the working tree exactly as-is (including local modifications and untracked files).\n    #[default]\n    PreserveWorkingTree,\n    /// Produce a clean checked-out working tree for tracked files.\n    ///\n    /// Local modifications and untracked files from the source are not copied.\n    CleanTracked,\n    /// Produce a clean worktree and also remove any untracked files (equivalent to\n    /// `git reset --hard` + `git clean -fd`).\n    ///\n    /// Note: ignored files are not removed by default `git clean`.\n    CleanAll,","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-fast-worktree/src/api.rs#L67-L103","documentation":"This error comes from the default delegate implementation of `unmount_overlay`, which is a stub: it discards the target path and immediately fails. Overlay worktree mounting is only supported by delegates that implement namespace-based unmount; this one explicitly does not. It indicates the caller asked a delegate to undo a `mount_overlay` operation it cannot perform.","triggerScenarios":"Calling `unmount_overlay(target)` on a delegate whose `unmount_overlay` uses the default/trait-provided stub implementation instead of an overridden one (typically on platforms or delegate types that lack mount-namespace support).","commonSituations":"Running on Linux configurations where the delegate was constructed without overlay-unmount capability; calling cleanup/teardown paths that unconditionally try to unmount an overlay worktree; library version where only `mount_overlay` was implemented for the chosen delegate.","solutions":["Check whether the concrete delegate type overrides `unmount_overlay`; if not, it cannot unmount overlays.","If you mounted the overlay, unmount it yourself with the matching mechanism, e.g. run `umount <target>` (or `fusermount -u`) in the mount namespace where it was mounted.","Guard the cleanup path: only call `unmount_overlay` when the delegate advertises unmount support, or treat this specific error as a no-op.","Upgrade/switch to a delegate implementation that supports overlay unmount delegation.","Release/delete the destination worktree directory manually once unmounted, since the library will not clean it up."],"exampleFix":"// before\nlet delegate = DefaultDelegate::new();\ndelegate.unmount_overlay(&overlay_path)?; // bails: not supported\n// after\n// unmount in the mount namespace yourself\ndetach_mount(&overlay_path)?; // e.g. run `umount <target>` via Command in the owning namespace\n","handlingStrategy":"fallback","validationCode":"// Only call when the delegate actually supports unmount.\nfn supports_unmount(d: &dyn Delegate) -> bool {\n    // e.g. feature-detect via a capability method or type check\n    d.capabilities().overlay_unmount\n}\nif !supports_unmount(&delegate) { skip_unmount(); }","typeGuard":"fn supports_overlay_unmount(d: &dyn Delegate) -> bool {\n    d.as_any().downcast_ref::<NamespaceDelegate>().is_some()\n}","tryCatchPattern":"match delegate.unmount_overlay(&target) {\n    Err(e) if e.to_string().contains(\"not supported\") => {\n        // fall back to manual umount in the owning namespace\n        manual_umount(&target)?;\n    }\n    r => r?,\n}","preventionTips":["Check delegate capabilities before mounting overlays you'll later need to unmount","Centralize mount/unmount pairs so both use the same delegate","Treat 'not supported' delegate errors as fallback triggers, not bugs","Run unmounts in the same mount namespace where the mount happened"],"tags":["filesystem","worktree","unimplemented","mount-namespace"],"backgroundTag":"operation-not-supported","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}