dagger/dagger · error
cannot determine diff of more than one upper directories
Error message
cannot determine diff of more than one upper directories
What it means
GetUpperdir derives the overlayfs upperdir of a snapshot by comparing the layer lists parsed from the lower and upper overlay mounts. The diff logic only supports the case where the upper mount's layer stack is exactly the lower mount's stack plus exactly one new top layer (the upperdir). When the upper mount contains more than one additional layer relative to the lower mount, the code cannot unambiguously attribute changes to a single upperdir and throws this error.
Solutions
- Ensure you diff between adjacent snapshots only: the upper snapshot must be exactly one layer on top of the lower snapshot
- Re-fetch both mounts at the same time so they refer to a consistent layer chain (avoid GC/remount races between calls)
- If you need multi-layer diffs, compute the diff incrementally layer by layer instead of a single GetUpperdir call
- Verify the lower mount is an overlay mount (not bind) so lowerlayers is the full stack rather than a single entry
Defensive patterns
Strategy: validation
Validate before calling
upperLayers, err := fsdiff.GetOverlayLayers(upperM)
if err != nil { return err }
var lowerLayers []string
if lowerM.Type == "bind" {
lowerLayers = []string{lowerM.Source}
} else {
lowerLayers, err = fsdiff.GetOverlayLayers(lowerM)
if err != nil { return err }
}
if len(upperLayers) != len(lowerLayers)+1 {
return fmt.Errorf("snapshots are not adjacent: upper has %d layers, lower has %d", len(upperLayers), len(lowerLayers))
} Prevention
- Only diff parent/child snapshot pairs (one layer apart)
- Fetch both mounts together to avoid GC/remount races
- Log parsed layer lists before diffing to catch count drift early
When it happens
Trigger: Calling differFor/GetUpperdir with lower=[1 overlay mount] and upper=[1 overlay mount] where the upper mount's lowerdir stack differs in length from the lower mount's stack by more than one entry — e.g. the lower snapshot was committed and re-based so its overlay gained 2+ new layers, or the lower mount is a plain bind mount (len(lowerlayers)==1) while the upper overlay has 3+ layers.
Common situations: Diffing across non-adjacent snapshot generations after multiple commits; a snapshotter that squashed or re-created layers between snapshots; comparing a bind-mounted base snapshot against a multi-layer overlay snapshot; containerd overlay snapshotter garbage-collecting or remounting layers between the two mount fetches.
Related errors
- failed to stat underlying file from bind mount
- layer must be common between upper and lower snapshots
- cannot determine upperdir from mount option
- could not find lowerdir in mount options
- could not find upperdir in mount options
AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05).
Data as JSON: /api/errors/3412762b5c3500dd.
Report an issue: GitHub.
Appendix: source
Thrown at engine/snapshots/fsdiff/overlay_linux.go:57
lowerlayers, err = GetOverlayLayers(lowerM)
if err != nil {
return "", err
}
} else {
return "", errors.Errorf("cannot get layer information from mount option (type = %q)", lowerM.Type)
}
upperM := upper[0]
if !IsOverlayMountType(upperM) {
return "", errors.Errorf("upper snapshot isn't overlay mounted (type = %q)", upperM.Type)
}
upperlayers, err := GetOverlayLayers(upperM)
if err != nil {
return "", err
}
if len(upperlayers) != len(lowerlayers)+1 {
return "", errors.Errorf("cannot determine diff of more than one upper directories")
}
for i := 0; i < len(lowerlayers); i++ {
if upperlayers[i] != lowerlayers[i] {
return "", errors.Errorf("layer %d must be common between upper and lower snapshots", i)
}
}
upperdir = upperlayers[len(upperlayers)-1]
} else {
return "", errors.Errorf("multiple mount configurations are not supported")
}
if upperdir == "" {
return "", errors.Errorf("cannot determine upperdir from mount option")
}
return upperdir, nil
}
func GetOverlayLayers(m mount.Mount) ([]string, error) {
var u stringView on GitHub (pinned to 82ba2681db)