{"record":{"id":"ab7f65b55558595e","repo":"dagger/dagger","slug":"container-directory-lazy-missing-mounted-director-ab7f65","errorCode":null,"errorMessage":"container directory lazy: missing mounted directory snapshot for %s","messagePattern":"container directory lazy: missing mounted directory snapshot for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/container.go","lineNumber":3312,"sourceCode":"\t\t\t\t}\n\t\t\t\tdir.Platform = detached.Platform\n\t\t\t\tdir.Services = slices.Clone(detached.Services)\n\t\t\t\tif dirPath, ok := detached.Dir.Peek(); ok {\n\t\t\t\t\tdir.Dir.setValue(dirPath)\n\t\t\t\t}\n\t\t\t\tif snapshot, ok := detached.Snapshot.Peek(); ok && snapshot != nil {\n\t\t\t\t\tdir.Snapshot.setValue(snapshot)\n\t\t\t\t}\n\t\t\t\tdir.Lazy = nil\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tmountedDirPath, ok := mountedDir.Dir.Peek()\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"container directory lazy: missing mounted directory path for %s\", mnt.Target)\n\t\t\t}\n\t\t\tmountedSnapshot, ok := mountedDir.Snapshot.Peek()\n\t\t\tif !ok || mountedSnapshot == nil {\n\t\t\t\treturn fmt.Errorf(\"container directory lazy: missing mounted directory snapshot for %s\", mnt.Target)\n\t\t\t}\n\t\t\tfinalDir := path.Join(mountedDirPath, subpath)\n\t\t\tif err := MountRef(ctx, mountedSnapshot, func(root string, _ *mount.Mount) error {\n\t\t\t\tresolvedPath, err := containerdfs.RootPath(root, finalDir)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tinfo, err := os.Lstat(resolvedPath)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn TrimErrPathPrefix(err, root)\n\t\t\t\t}\n\t\t\t\tif !info.IsDir() {\n\t\t\t\t\treturn notADirectoryError{fmt.Errorf(\"path %s is a file, not a directory\", lazy.Path)}\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}); err != nil {\n\t\t\t\treturn RestoreErrPath(err, lazy.Path)\n\t\t\t}","sourceCodeStart":3294,"sourceCodeEnd":3330,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/container.go#L3294-L3330","documentation":"When lazily materializing a container-mounted directory, Dagger needs the directory's on-disk snapshot to mount it and read the requested subpath. If the Directory result has a path but its Snapshot (the committed content-snapshot reference) is absent or nil, evaluation cannot proceed and this error names the mount target. It indicates a partially-materialized directory result, usually after persisted-state replay.","triggerScenarios":"Reading container.directory(target) or its contents where the withMountedDirectory source directory was restored from cache with Dir set but Snapshot uncomputed — e.g. the source dir was cloned/peeked without ever being snapshotted in this engine session.","commonSituations":"Cached module runs across engine restarts; interrupted/failed snapshotting of the source directory; engine cache corruption or version skew after upgrade.","solutions":["Force full evaluation (including snapshot) of the mounted source directory before consuming the container directory, e.g. copy/export it first","Re-run the pipeline in a fresh session to rebuild and re-snapshot the directory","Prune/restart the engine cache to remove incomplete persisted results","Update dagger CLI+engine together; report a core lazy-persistence bug if it reproduces"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Force snapshot materialization by touching the directory before use\nif _, err := srcDir.Entries(ctx); err != nil { return err }","typeGuard":null,"tryCatchPattern":"d, err := ctr.Directory(ctx, target)\nif err != nil && strings.Contains(err.Error(), \"missing mounted directory snapshot\") {\n\t// re-snapshot the source directory (export/import round-trip) and retry\n}","preventionTips":["Touch the source directory (entries/export) so its snapshot is computed before mounting","Don't share directory results across engine restarts via cached IDs","Keep CLI/engine versions in sync","Prune cache after failed or interrupted runs"],"tags":["lazy-evaluation","mount","snapshot","cache"],"backgroundTag":"missing-mounted-directory-snapshot","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"}