{"record":{"id":"9e865fccc4fa1f3b","repo":"dagger/dagger","slug":"copy-changed-paths-w-9e865f","errorCode":null,"errorMessage":"copy changed paths: %w","messagePattern":"copy changed paths: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/directory.go","lineNumber":3180,"sourceCode":"\n\t\tif err := removeChangesetPaths(root, targetDir, paths.Removed); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif diffSnapshot != nil {\n\t\t\terr = MountRef(ctx, diffSnapshot, func(srcRoot string, srcMnt *mount.Mount) error {\n\t\t\t\treturn copier.Copy(ctx,\n\t\t\t\t\tlayercopy.Mount{Root: srcRoot, Mount: srcMnt},\n\t\t\t\t\tdiffPath,\n\t\t\t\t\ttargetDir,\n\t\t\t\t\tlayercopy.CopyOptions{\n\t\t\t\t\t\tCopyDirContents: true,\n\t\t\t\t\t\tReplaceExisting: true,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}, mountRefAsReadOnly)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"copy changed paths: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\tif err := mkdirChangesetAddedDirs(ctx, copier, targetDir, paths); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tusage, err = copier.Usage()\n\t\treturn err\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tref, err := newRef.CommitWithUsage(ctx, usage)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"commit changed directory: %w\", err)\n\t}","sourceCodeStart":3162,"sourceCodeEnd":3198,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/directory.go#L3162-L3198","documentation":"This error wraps failure of the copier run that copies each changed path (added/modified entries of the changeset) from the diff snapshot into the target directory's mounted snapshot, using CopyDirContents and ReplaceExisting. It is the copy-loop stage of applyChangesToSnapshot.","triggerScenarios":"Applying a Directory changeset where the copy of a changed path fails: source path missing from the diff snapshot, cross-device or permission errors during copy, interrupted context, or mountRefAsReadOnly mount setup failure.","commonSituations":"Changes referencing paths removed between diff computation and application; filesystem permission anomalies; large trees hitting timeouts or ENOSPC.","solutions":["Inspect the wrapped cause to identify the failing path or mount; verify that path exists in the before/after directories.","Rerun the operation; transient IO/context errors typically resolve on retry.","Check engine disk space and permissions on the cache volume.","If a specific path is consistently failing, recreate the changeset for that path explicitly (withNewFile/withDirectory) to bypass the diff path."],"exampleFix":"// before\nif err := copyFn(...); err != nil {\n\treturn fmt.Errorf(\"copy changed paths: %w\", err)\n}\n// after\nif err := copyFn(...); err != nil {\n\tif errors.Is(err, fs.ErrNotExist) {\n\t\treturn fmt.Errorf(\"copy changed paths: path vanished between diff and apply: %w\", err)\n\t}\n\treturn fmt.Errorf(\"copy changed paths: %w\", err)\n}","handlingStrategy":"try-catch","validationCode":"// verify changed paths still exist in the after directory before applying\nfor _, p := range changedPaths { if _, err := afterDir.File(p).ID(ctx); err != nil { return fmt.Errorf(\"path missing: %s\", p) } }","typeGuard":null,"tryCatchPattern":"out, err := applyChanges(); if err != nil { if errors.Is(err, fs.ErrNotExist) { /* rebuild the changeset */ } return err }","preventionTips":["Don't mutate source directories between diff and apply","Check permissions on copied paths","Keep disk space available during copy","Apply changesets immediately after creating them"],"tags":["dagger","filesystem","copy","directory"],"backgroundTag":"copy-path-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"}