{"record":{"id":"23590fa16c509dd7","repo":"dagger/dagger","slug":"copy-changed-paths-w","errorCode":null,"errorMessage":"copy changed paths: %w","messagePattern":"copy changed paths: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/changeset.go","lineNumber":1550,"sourceCode":"\t\t\t\t\t\tReplaceExisting: true,\n\t\t\t\t\t\t// Linking from the diff snapshot into the mounted\n\t\t\t\t\t\t// work tree crosses devices, so every attempt would\n\t\t\t\t\t\t// just fail into the copy fallback.\n\t\t\t\t\t\tDisableSourceHardlinks: true,\n\t\t\t\t\t\t// The diff snapshot can carry .git entries that\n\t\t\t\t\t\t// ComputePaths never reported: the stat-sensitive\n\t\t\t\t\t\t// differ flags files whose content is identical but\n\t\t\t\t\t\t// whose timestamps diverge across content-deduped\n\t\t\t\t\t\t// snapshots. Overlaying those onto the temporary\n\t\t\t\t\t\t// repository corrupts the merge.\n\t\t\t\t\t\tFilter: layercopy.Filter{\n\t\t\t\t\t\t\tExclude: []string{\".git\"},\n\t\t\t\t\t\t},\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\t}\n\n\tif err := mkdirChangesetAddedDirs(ctx, copier, ws.dir, paths); err != nil {\n\t\treturn err\n\t}\n\treturn ws.touchAppliedPaths(paths)\n}\n\n// touchAppliedPaths bumps the mtime of every path the changeset wrote so git\n// can see the change. Snapshot contents carry normalized timestamps and the\n// copier preserves them, so a same-size edit can leave a file's mtime and\n// size both identical to the index entry; with core.checkStat=minimal (see\n// gitEphemeralConfig) git add would then skip re-hashing it and silently\n// drop the change from the branch commit.\nfunc (ws *gitMergeWorkspace) touchAppliedPaths(paths *ChangesetPaths) error {\n\tfor _, p := range slices.Concat(paths.Added, paths.Modified) {","sourceCodeStart":1532,"sourceCodeEnd":1568,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/changeset.go#L1532-L1568","documentation":"After mounting the diff snapshot read-only, applyContent copies the changed paths into the merge work tree via copier.Copy (ReplaceExisting, .git excluded); any failure inside that copy or the MountRef callback is wrapped as 'copy changed paths: <cause>'. This is the core content-transfer step of applying a changeset to a git merge workspace.","triggerScenarios":"copier.Copy from the mounted diff snapshot into the merge workspace fails — cross-device copy fallback errors, EACCES/EPERM on destination paths, ENOSPC on the overlay upperdir, I/O errors reading the source mount, or an error returned by the MountRef mount callback itself.","commonSituations":"Disk-full during large merges; read-only or corrupted overlay upperdir; symlink or permission edge cases in the diff snapshot; source mount busy (EBUSY) or unavailable; checksum/verification failure of cached blobs.","solutions":["Read the wrapped cause for the concrete errno; free disk space if ENOSPC","Retry the merge — the workspace is ephemeral and rebuilt from scratch each time","Verify the diff snapshot contents (e.g. export it) to rule out corrupted cached layers","Check mount support/permissions on the host (overlayfs, userns) if the MountRef step fails","Update the engine; copy fallback and .git-exclusion filtering have had fixes"],"exampleFix":"// before\nerr = MountRef(ctx, diffRef, func(srcRoot string, srcMnt *mount.Mount) error {\n\treturn copier.Copy(ctx, layercopy.Mount{Root: srcRoot, Mount: srcMnt}, diffPath, ws.dir, opts)\n}, mountRefAsReadOnly)\nif err != nil {\n\treturn fmt.Errorf(\"copy changed paths: %w\", err)\n}\n// after (caller-side: retry transient copy failures once)\nerr = MountRef(ctx, diffRef, func(srcRoot string, srcMnt *mount.Mount) error {\n\treturn copier.Copy(ctx, layercopy.Mount{Root: srcRoot, Mount: srcMnt}, diffPath, ws.dir, opts)\n}, mountRefAsReadOnly)\nif err != nil && errors.Is(err, syscall.EIO) {\n\terr = retryMountAndCopy(ctx, diffRef, diffPath, ws.dir, opts)\n}\nif err != nil {\n\treturn fmt.Errorf(\"copy changed paths: %w\", err)\n}","handlingStrategy":"retry","validationCode":"// verify mount capability and free space before large merges\nif err := checkOverlayMountSupport(); err != nil {\n\treturn fmt.Errorf(\"host cannot mount diff snapshots: %w\", err)\n}\nif free, _ := diskFree(engineCacheDir); free < requiredBytes {\n\treturn fmt.Errorf(\"need %d bytes free for merge copy\", requiredBytes)\n}","typeGuard":"func isCopyChangedPathsError(err error) bool {\n\treturn err != nil && strings.Contains(err.Error(), \"copy changed paths:\")\n}","tryCatchPattern":"err := dag.Directory().Merge(...)\nif err != nil {\n\tvar serr syscall.Errno\n\tif isCopyChangedPathsError(err) && errors.As(err, &serr) && (errors.Is(err, syscall.ENOSPC) || errors.Is(err, syscall.EIO)) {\n\t\t// free space / rebuild snapshot, then retry once\n\t}\n\treturn err\n}","preventionTips":["Monitor engine cache disk usage; ENOSPC is the most common cause of copy failures","Keep the engine/host kernel and overlayfs healthy (dmesg for I/O errors)","Export or sanity-check large diffs before merging them","Retry merges — each attempt rebuilds the ephemeral workspace"],"tags":["filesystem","copy","git-merge","mount"],"backgroundTag":"file-copy-failed","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}