{"record":{"id":"c39b74912989c78b","repo":"xai-org/grok-build","slug":"overlay-mount-delegation-not-supported-by-this-del","errorCode":null,"errorMessage":"overlay mount delegation not supported by this delegate","messagePattern":"overlay mount delegation not supported by this delegate","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-fast-worktree/src/api.rs","lineNumber":78,"sourceCode":"    /// 4. Clean up stale git state (lock files, worktree registrations)\n    fn create_snapshot(&self, source: &Path, dest: &Path) -> Result<DelegateSnapshotResult>;\n\n    /// Delete a btrfs snapshot worktree.\n    ///\n    /// If `worktree_path` is a bind mount, the implementation should unmount it,\n    /// delete the btrfs snapshot, and clean up the mount point.\n    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    ///","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-fast-worktree/src/api.rs#L60-L96","documentation":"mount_overlay is a trait method with a default implementation that always errors, so btrfs-only WorktreeDelegate implementations still compile. Calling overlay worktree mounting on a delegate that doesn't support it (e.g. a btrfs-snapshot delegate lacking CAP_SYS_ADMIN-based overlay mounting) hits this bail.","triggerScenarios":"Invoking an overlay-based worktree operation against a delegate whose type only implements the btrfs snapshot path and does not override mount_overlay.","commonSituations":"Configuring the tool to use a btrfs delegate but requesting overlay worktrees; running on a filesystem/kernel where the chosen delegate can't mount overlays; switching delegate backends without updating worktree mode.","solutions":["Select/configure a delegate that supports overlay mounting (one that overrides mount_overlay, typically requiring CAP_SYS_ADMIN)","Switch the worktree mode to the delegate's supported strategy (e.g. btrfs snapshots)","Implement mount_overlay in your custom delegate if you own the trait impl","Verify the environment (kernel/privileges) supports the delegate you picked"],"exampleFix":"// before\nlet delegate = BtrfsDelegate::new();\ndelegate.mount_overlay(&lower, &upper, &work, &target)?;\n// after\nlet delegate = OverlayDelegate::new(); // supports mount_overlay\ndelegate.mount_overlay(&lower, &upper, &work, &target)?;","handlingStrategy":"fallback","validationCode":"fn delegate_supports_overlay(d: &dyn WorktreeDelegate) -> bool {\n    d.supports_overlay() // expose a capability probe; default false for btrfs-only delegates\n}","typeGuard":null,"tryCatchPattern":"let result = match delegate_supports_overlay(delegate) {\n    true => delegate.mount_overlay(&lower, &upper, &work, &target),\n    false => delegate.snapshot_worktree(&target) // fallback strategy\n        .map_err(|e| e.context(\"overlay unsupported; snapshot fallback failed\")),\n};","preventionTips":["Probe delegate capabilities before choosing an overlay-based workflow","Configure the delegate backend to match your worktree mode (overlay vs btrfs snapshot)","Ensure CAP_SYS_ADMIN/privileges when a delegate needs to mount overlays","Document required delegate features next to custom impls"],"tags":["filesystem","worktree","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}