wagoodman/dive · error

failed to layout %q footer: %w

Error message

failed to layout %q footer: %w

What it means

The layout Manager wraps failures of footer elements' Layout calls (the status bar and, in debug mode, other footer panes laid out bottom-up with border padding). The %q is the footer element name (typically "status" or "debug"). The wrapped error comes from that footer's gocui SetView or its controller Setup.

Source

Thrown at cmd/dive/cli/internal/ui/v1/layout/manager.go:167

	// layout footers top down (which is why the list is reversed). Top down is needed due to border overlap.
	if elements, exists := lm.elements[LocationFooter]; exists {
		for idx := len(elements) - 1; idx >= 0; idx-- {
			element := elements[idx]
			height := footerHeights[idx]
			var topY, bottomY, bottomPadding int
			for oIdx := 0; oIdx <= idx; oIdx++ {
				bottomPadding += footerHeights[oIdx]
			}
			topY = area.maxY - bottomPadding - height
			// +1 for border
			bottomY = topY + height + 1

			// layout the footer within the allocated space
			// note: since the headers and rows are inclusive counting from -1 (to account for a border) we must
			// do the same vertically, thus a -1 is needed for a starting Y
			err := element.Layout(g, area.minX, topY, area.maxX, bottomY)
			if err != nil {
				return fmt.Errorf("failed to layout %q footer: %w", element.Name(), err)
			}
		}
	}
	return nil
}

func (lm *Manager) notifyLayoutChange() error {
	for _, elements := range lm.elements {
		for _, element := range elements {
			err := element.OnLayoutChange()
			if err != nil {
				return err
			}
		}
	}
	return nil
}

View on GitHub (pinned to d6c691947f)

Solutions

  1. Increase terminal height so footers fit below the main rows
  2. Inspect the wrapped error for the specific footer and fix that (usually the status view)
  3. Avoid running dive in embedded terminals with fewer than ~10 rows
  4. If embedding, clamp footerHeights so their sum stays under area.maxY
Defensive patterns

Strategy: validation

Validate before calling

// skip footer layout when there is no vertical room left
totalFooter := 0
for _, h := range footerHeights { totalFooter += h }
if area.maxY-area.minY <= totalFooter { return nil }

Try / catch

if err := lm.layoutFooters(g, area, footerHeights); err != nil {
    return fmt.Errorf("footer layout failed: %w", err)
}

Prevention

When it happens

Trigger: A footer element's Layout failing when g.SetView is called with the computed topY/bottomY: negative or inverted Y coordinates when the terminal is too short for the stacked footer heights, or the footer controller's Setup returning an error on first creation.

Common situations: Terminal height too small to fit main content plus footer rows; resizing to near-zero height triggers layout; multiple footers whose combined heights (footerHeights) exceed area.maxY; a footer Setup failing (e.g. debug view write errors).

Related errors


AI-assisted analysis of wagoodman/dive@d6c691947f (2026-08-15). Data as JSON: /api/errors/e5bc082e58a90532. Report an issue: GitHub.