{"record":{"id":"0b8e49e86b8d01de","repo":"dagger/dagger","slug":"stage-before-delta-w","errorCode":null,"errorMessage":"stage before delta: %w","messagePattern":"stage before delta: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/changeset_delta.go","lineNumber":86,"sourceCode":"\t\t}\n\t\tdefer os.RemoveAll(tmpRoot)\n\t\ttmpBefore := filepath.Join(tmpRoot, \"before\")\n\t\ttmpAfter := filepath.Join(tmpRoot, \"after\")\n\n\t\t// Modified files exist at the same path on both sides, so they can\n\t\t// never participate in rename pairing; stage them only when numstat\n\t\t// needs their content.\n\t\tvar beforePaths, afterPaths []string\n\t\tif materializeModified {\n\t\t\tbeforePaths = slices.Clone(modified)\n\t\t\tafterPaths = slices.Clone(modified)\n\t\t}\n\t\tif detectRenames {\n\t\t\tbeforePaths = append(beforePaths, delta.removedFiles...)\n\t\t\tafterPaths = append(afterPaths, delta.addedFiles...)\n\t\t}\n\t\tif err := materializeDeltaFiles(ctx, beforeDir, tmpBefore, beforePaths); err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"stage before delta: %w\", err)\n\t\t}\n\t\tif err := materializeDeltaFiles(ctx, afterDir, tmpAfter, afterPaths); err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"stage after delta: %w\", err)\n\t\t}\n\n\t\tif detectRenames {\n\t\t\tgitFC, err := compareDirectories(ctx, tmpBefore, tmpAfter)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"compare delta files: %w\", err)\n\t\t\t}\n\t\t\tfc.Added = gitFC.Added\n\t\t\tfc.Removed = gitFC.Removed\n\t\t\tfc.Renamed = gitFC.Renamed\n\t\t}\n\t\tif withStats {\n\t\t\tstats, err = compareDirectoriesNumStat(ctx, tmpBefore, tmpAfter)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"numstat delta files: %w\", err)","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/changeset_delta.go#L68-L104","documentation":"materializeDeltaFiles copies the before-side paths (modified candidates plus removed files when detecting renames) from beforeDir into the staging tmpBefore tree; failure is wrapped as \"stage before delta: %w\". It means the delta files on the \"before\" side could not be copied out for git comparison.","triggerScenarios":"computeChangesetPathsDelta with rename detection or stats enabled, when copying beforeDir paths fails: a listed path vanished from beforeDir, permission denied, source file read error, or context cancellation mid-copy.","commonSituations":"Tree mutated between collectChangesetDelta and staging (file removed/renamed concurrently); unreadable file due to permission changes; disk full while writing the staging copy.","solutions":["Check the wrapped cause for the specific path that failed to copy","Ensure the before/after trees are not modified concurrently (snapshot them)","Verify disk space in TMPDIR; staging duplicates the delta content","Retry once the tree is stable"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for _, p := range beforePaths {\n  if _, err := os.Stat(filepath.Join(beforeDir, p)); err != nil { return fmt.Errorf(\"before path %s: %w\", p, err) }\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n  return fmt.Errorf(\"staging before-side files failed: %w\", err)\n}","preventionTips":["Freeze the before tree (snapshot) before staging","Ensure sufficient TMPDIR space for duplicated delta content","Check source file readability/permissions beforehand"],"tags":["filesystem","copy","diff"],"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-12T12:17:11.808Z"}