dagger/dagger · error
stage before delta: %w
Error message
stage before delta: %w
What it means
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.
Source
Thrown at core/changeset_delta.go:86
}
defer os.RemoveAll(tmpRoot)
tmpBefore := filepath.Join(tmpRoot, "before")
tmpAfter := filepath.Join(tmpRoot, "after")
// Modified files exist at the same path on both sides, so they can
// never participate in rename pairing; stage them only when numstat
// needs their content.
var beforePaths, afterPaths []string
if materializeModified {
beforePaths = slices.Clone(modified)
afterPaths = slices.Clone(modified)
}
if detectRenames {
beforePaths = append(beforePaths, delta.removedFiles...)
afterPaths = append(afterPaths, delta.addedFiles...)
}
if err := materializeDeltaFiles(ctx, beforeDir, tmpBefore, beforePaths); err != nil {
return nil, nil, fmt.Errorf("stage before delta: %w", err)
}
if err := materializeDeltaFiles(ctx, afterDir, tmpAfter, afterPaths); err != nil {
return nil, nil, fmt.Errorf("stage after delta: %w", err)
}
if detectRenames {
gitFC, err := compareDirectories(ctx, tmpBefore, tmpAfter)
if err != nil {
return nil, nil, fmt.Errorf("compare delta files: %w", err)
}
fc.Added = gitFC.Added
fc.Removed = gitFC.Removed
fc.Renamed = gitFC.Renamed
}
if withStats {
stats, err = compareDirectoriesNumStat(ctx, tmpBefore, tmpAfter)
if err != nil {
return nil, nil, fmt.Errorf("numstat delta files: %w", err)View on GitHub (pinned to 82ba2681db)
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
Defensive patterns
Strategy: validation
Validate before calling
for _, p := range beforePaths {
if _, err := os.Stat(filepath.Join(beforeDir, p)); err != nil { return fmt.Errorf("before path %s: %w", p, err) }
} Try / catch
if err != nil {
return fmt.Errorf("staging before-side files failed: %w", err)
} Prevention
- Freeze the before tree (snapshot) before staging
- Ensure sufficient TMPDIR space for duplicated delta content
- Check source file readability/permissions beforehand
When it happens
Trigger: 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.
Common situations: Tree mutated between collectChangesetDelta and staging (file removed/renamed concurrently); unreadable file due to permission changes; disk full while writing the staging copy.
Related errors
- stage after delta: %w
- compute paths: %w
- copy changed paths: %w
- collect delta: %w
- verify modified files: %w
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/0b8e49e86b8d01de.
Report an issue: GitHub.