{"record":{"id":"e554bfb68e647ff6","repo":"dagger/dagger","slug":"failed-to-mount-parent-directory-w","errorCode":null,"errorMessage":"failed to mount parent directory: %w","messagePattern":"failed to mount parent directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/directory.go","lineNumber":2376,"sourceCode":"\t\treturn fmt.Errorf(\"failed to get source directory ref: %w\", err)\n\t}\n\n\tquery, err := CurrentQuery(ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get current query: %w\", err)\n\t}\n\tdestDirTrailingSlash := strings.HasSuffix(destDir, \"/\") || strings.HasSuffix(destDir, \"/.\")\n\tdestDir = path.Join(ourDir, destDir)\n\tif destDirTrailingSlash && !strings.HasSuffix(destDir, \"/\") {\n\t\tdestDir += \"/\"\n\t}\n\n\tvar parentRoot string\n\tvar releaseParent func() error\n\tif dirRef != nil {\n\t\tparentRoot, _, releaseParent, err = MountRefCloser(ctx, dirRef, mountRefAsReadOnly)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to mount parent directory: %w\", err)\n\t\t}\n\t\tdefer releaseParent()\n\t}\n\n\tnewRef, err := query.SnapshotManager().New(\n\t\tctx,\n\t\tdirRef,\n\t\tbkcache.WithRecordType(bkclient.UsageRecordTypeRegular),\n\t\tbkcache.WithDescription(\"Directory.withDirectoryDockerfileCompat\"),\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"snapshotmanager.New failed: %w\", err)\n\t}\n\tdefer newRef.Release(context.WithoutCancel(ctx))\n\n\tvar usage snapshots.Usage\n\tif err := MountRef(ctx, newRef, func(copyDest string, destMnt *mount.Mount) error {\n\t\tvar ownership *Ownership","sourceCodeStart":2358,"sourceCodeEnd":2394,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/directory.go#L2358-L2394","documentation":"WithDirectoryDockerfileCompat mounts the parent directory's snapshot read-only (via MountRefCloser) so ownership can be resolved against it and dest-path existence checked. If mounting that cached snapshot ref into the host fails (overlay/mount/underlying storage error), the error is wrapped as 'failed to mount parent directory'.","triggerScenarios":"Calling Directory.withDirectory with Dockerfile compat when dirRef is non-nil and the engine's snapshot mount (OverlayFS/ FuseFS or containerd mount) fails for the parent directory ref — typically disk, permissions, or mount-support issues on the host.","commonSituations":"Running the Dagger engine on hosts without proper mount support (restricted containers, missing /dev/fuse, seccomp blocking mount syscalls), full disk, or corrupted cache data under /var/lib/dagger.","solutions":["Check the engine host has mount support (FUSE/overlayfs permitted; not a heavily sandboxed container) and that /var/lib/dagger has free disk space.","Clear the engine cache (dagger engine prune or restart engine) in case a cached snapshot ref is corrupted.","Upgrade the Dagger engine to the latest version; if it persists, file an issue with the wrapped error and trace."],"exampleFix":"// no code fix; host remediation example\n// before: engine inside unprivileged container without fuse\n// after: run engine with --privileged or on a host with FUSE enabled","handlingStrategy":"retry","validationCode":"// Host checks before running the pipeline\ncmd := exec.Command(\"sh\", \"-c\", \"df --output=avail -k /var/lib/dagger | tail -1\")\nout, _ := cmd.Output()\nif kb, _ := strconv.Atoi(strings.TrimSpace(string(out))); kb < 1_000_000 {\n    log.Fatal(\"not enough free space for Dagger engine snapshot mounts\")\n}","typeGuard":null,"tryCatchPattern":"var serr *fs.PathError\nif errors.As(err, &serr) && strings.Contains(err.Error(), \"failed to mount parent directory\") {\n    // restart engine / prune cache, then retry once\n    restartEngine(); return retry(op)\n}","preventionTips":["Run the engine on hosts permitting FUSE/overlay mounts (avoid heavily sandboxed environments).","Monitor /var/lib/dagger disk usage and prune cache regularly.","Keep the engine updated to pick up mount-handling fixes."],"tags":["filesystem","mount","engine","directory"],"backgroundTag":"mount-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}