dagger/dagger · critical
merge dropped declared changes
Error message
merge dropped declared changes: %s (engine bug: the merge workspace lost applied content)
What it means
This error is a self-check inside Dagger's git-based changeset merge (verifyMergedPaths in core/changeset.go:1614). After a conflict-free git merge in a temporary repository, the engine verifies that every file path the changesets declared as added or modified actually exists in the merged worktree; if any are missing it reports this error because there is no legitimate way a conflict-free merge should drop declared content. It signals an engine-internal bug (e.g. a stale .git/HEAD redirecting the ours commit so the merge silently resolves to one side), not user error.
Solutions
- Upgrade or downgrade the Dagger engine version — this indicates an engine bug; check dagger.VERSION changelog and GitHub issues for 'merge dropped declared changes' and report with a repro if new.
- Simplify the merge: verify which declared paths are listed in the error and check whether those files are identical in size/mtime on both sides (deduped snapshots can confuse git stat).
- As a workaround, perform the merge manually by exporting both directories and merging outside the engine (e.g. via git in a container) until the engine fix lands.
- Retry the operation; if a stale temp workspace was involved, a fresh engine session may avoid the corrupted state.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-validate the changeset paths you expect to survive the merge
for _, p := range append(changeset.Added, changeset.Modified...) {
if strings.HasSuffix(p, "/") { continue }
if _, err := os.Stat(path.Join(baseDirPath, p)); errors.Is(err, os.ErrNotExist) {
return fmt.Errorf("path %q not present in base; merge cannot apply it", p)
}
} Type guard
func isMergeDroppedChangesErr(err error) bool {
return err != nil && strings.Contains(err.Error(), "merge dropped declared changes")
} Try / catch
merged, err := dir.WithChangeset(cs).Directory(ctx)
if err != nil {
if isMergeDroppedChangesErr(err) {
// engine bug: report to Dagger with repro; do not retry blindly
log.Fatalf("engine integrity failure, please report: %v", err)
}
return err
} Prevention
- Keep the Dagger engine and CLI versions in sync and up to date
- Avoid depending on same-size/same-mtime edits when layering changesets
- Pin a known-good engine version; watch Dagger releases for merge-related fixes
- If triggered, file a minimal repro — this error is designed to surface engine bugs, not user mistakes
When it happens
Trigger: Calling Directory.withChangeset / merge APIs (gitMergeChangesets) where the merge reports success and conflicts are empty, but files the changeset declared Added or Modified are absent from the merged worktree during os.Lstat in verifyMergedPaths.
Common situations: Encountered during Dagger engine upgrades or regressions in the temporary merge-repository plumbing; historically caused by stale .git/HEAD from a changeset diff pointing the 'ours' branch at the wrong commit, or mtime/size-identical edits being skipped by git add (core.checkStat=minimal). Users see it only as an opaque engine bug report.
Related errors
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/12aa05be733b6372.
Report an issue: GitHub.
Appendix: source
Thrown at core/changeset.go:1614
}
paths := content.paths.withoutGitMeta()
for _, p := range slices.Concat(paths.Added, paths.Modified) {
if strings.HasSuffix(p, "/") {
continue
}
full, err := RootPathWithoutFinalSymlink(ws.root, path.Join(ws.dir, p))
if err != nil {
return err
}
if _, err := os.Lstat(full); errors.Is(err, os.ErrNotExist) {
missing = append(missing, p)
} else if err != nil {
return TrimErrPathPrefix(err, ws.root)
}
}
}
if len(missing) > 0 {
return fmt.Errorf("merge dropped declared changes: %s (engine bug: the merge workspace lost applied content)", strings.Join(missing, ", "))
}
return nil
}
// withGitMergeWorkspace sets up a workspace for git merge operations, runs the provided
// function, then commits and returns the resulting directory.
func withGitMergeWorkspace(ctx context.Context, base dagql.ObjectResult[*Directory], description string, fn func(ws *gitMergeWorkspace) error) (*Directory, error) {
cache, err := dagql.EngineCache(ctx)
if err != nil {
return nil, err
}
if err := cache.Evaluate(ctx, base); err != nil {
return nil, fmt.Errorf("evaluate base: %w", err)
}
baseRef, err := base.Self().Snapshot.GetOrEval(ctx, base.Result)
if err != nil {
return nil, fmt.Errorf("evaluate base: %w", err)View on GitHub (pinned to 82ba2681db)