wagoodman/dive · error

unable to setup row layout for %s: %w

Error message

unable to setup row layout for %s: %w

What it means

TUI layout error from layoutRow(): after gocui.SetView created (or returned) the header and body views for a row, the caller-supplied setup() callback failed and is wrapped with the view name. Setup configures the freshly created view pair (e.g. wrapping, titles, render helpers), so this fires only when the views are newly created (IsNewView) — typically on first layout or after a view teardown.

Source

Thrown at cmd/dive/cli/internal/ui/v1/layout/compound/layer_details_column.go:64

	return nil
}

func (cl *LayerDetailsCompoundLayout) layoutRow(g *gocui.Gui, minX, minY, maxX, maxY int, viewName string, setup func(*gocui.View, *gocui.View) error) error {
	log.WithFields("ui", cl.Name()).Tracef("layoutRow(g, minX: %d, minY: %d, maxX: %d, maxY: %d, viewName: %s, <setup func>)", minX, minY, maxX, maxY, viewName)
	// header + border
	headerHeight := 2

	// TODO: investigate overlap
	// note: maxY needs to account for the (invisible) border, thus a +1
	headerView, headerErr := g.SetView(viewName+"Header", minX, minY, maxX, minY+headerHeight+1, 0)

	// we are going to overlap the view over the (invisible) border (so minY will be one less than expected)
	bodyView, bodyErr := g.SetView(viewName, minX, minY+headerHeight, maxX, maxY, 0)

	if utils.IsNewView(bodyErr, headerErr) {
		err := setup(bodyView, headerView)
		if err != nil {
			return fmt.Errorf("unable to setup row layout for %s: %w", viewName, err)
		}
	}
	return nil
}

func (cl *LayerDetailsCompoundLayout) Layout(g *gocui.Gui, minX, minY, maxX, maxY int) error {
	log.WithFields("ui", cl.Name()).Tracef("layout(minX: %d, minY: %d, maxX: %d, maxY: %d)", minX, minY, maxX, maxY)

	layouts := []view.View{
		cl.layer,
		cl.layerDetails,
		cl.imageDetails,
	}

	rowHeight := maxY / 3
	for i := 0; i < 3; i++ {
		if err := cl.layoutRow(g, minX, i*rowHeight, maxX, (i+1)*rowHeight, layouts[i].Name(), layouts[i].Setup); err != nil {
			return fmt.Errorf("unable to layout %q: %w", layouts[i].Name(), err)

View on GitHub (pinned to d6c691947f)

Solutions

  1. Check the wrapped inner error from the setup callback for the concrete cause.
  2. Run in a terminal of at least ~80x24 so each row has room for the 2-line header plus body.
  3. Avoid resizing while the TUI is starting up.
  4. Report upstream with terminal size and the full error chain if reproducible at normal sizes.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Initial TUI layout (or re-layout after resize destroyed views) where the per-view setup function returns an error: setting view options on a view with invalid geometry, or a renderer failing to bind to the new view object.

Common situations: Terminals too small for the header+body rows; resizing forcing view recreation mid-session; bugs in view setup code paths exercised by unusual geometries.

Related errors


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