wagoodman/dive · warning
unable to propagate layer tree: %w
Error message
unable to propagate layer tree: %w
What it means
SetTreeByLayer wraps errors from vm.ModelTree.VisitDepthChildFirst while copying per-node ViewInfo (collapse/hidden state) onto the freshly stacked tree. The visitor in this code path always returns nil, so the wrapped error can only come from the traversal machinery itself — in practice this is a defensive, near-unreachable wrapper.
Source
Thrown at cmd/dive/cli/internal/ui/v1/viewmodel/filetree.go:128
if topTreeStop > len(vm.RefTrees)-1 {
return fmt.Errorf("invalid layer index given: %d of %d", topTreeStop, len(vm.RefTrees)-1)
}
newTree, err := vm.comparer.GetTree(filetree.NewTreeIndexKey(bottomTreeStart, bottomTreeStop, topTreeStart, topTreeStop))
if err != nil {
return fmt.Errorf("unable to fetch layer tree from cache: %w", err)
}
// preserve vm state on copy
visitor := func(node *filetree.FileNode) error {
newNode, err := newTree.GetNode(node.Path())
if err == nil {
newNode.Data.ViewInfo = node.Data.ViewInfo
}
return nil
}
err = vm.ModelTree.VisitDepthChildFirst(visitor, nil)
if err != nil {
return fmt.Errorf("unable to propagate layer tree: %w", err)
}
vm.ModelTree = newTree
return nil
}
// CursorUp performs the internal view's buffer adjustments on cursor up. Note: this is independent of the gocui buffer.
func (vm *FileTreeViewModel) CursorUp() bool {
if vm.TreeIndex <= 0 {
return false
}
vm.TreeIndex--
if vm.TreeIndex < vm.bufferIndexLowerBound {
vm.bufferIndexLowerBound--
}
if vm.bufferIndex > 0 {
vm.bufferIndex--
}View on GitHub (pinned to d6c691947f)
Solutions
- If in stock dive, capture the full error chain and report upstream — it indicates corrupted tree state
- Audit forks for changes to the visitor closure (it must keep returning nil for benign misses)
- Ensure no goroutine mutates vm.ModelTree concurrently with layer switches
- Re-run analysis on the image to rebuild trees from scratch
Defensive patterns
Strategy: try-catch
Try / catch
if err := vm.ModelTree.VisitDepthChildFirst(visitor, nil); err != nil {
return fmt.Errorf("unable to propagate layer tree: %w", err)
} Prevention
- Keep visitor closures nil-error in stock paths
- Don't mutate ModelTree from other goroutines
- If forking, add fallible ops only after auditing traversal order
When it happens
Trigger: VisitDepthChildFirst returning an error while walking the old model tree; the closure never errors, so this requires a tree in a structurally invalid state (nil root, corrupted parent/child links) or modified traversal code in a fork.
Common situations: Practically unseen in stock dive; possible in forks that add fallible logic to the state-copy visitor; memory corruption or concurrent mutation of ModelTree from another goroutine could theoretically trip the walker.
Related errors
- unable to propagate tree on cursorLeft: %w
- unable to propagate vm model tree: %w
- file tree has path errors (use '--ignore-errors' to attempt
- unable to setup debug controller: %w
- notifyOnViewOptionChangeListeners error: %w
AI-assisted analysis of wagoodman/dive@d6c691947f (2026-08-15).
Data as JSON: /api/errors/567160f65faf34a4.
Report an issue: GitHub.