wagoodman/dive · error
failed to layout '%s' column: %w
Error message
failed to layout '%s' column: %w
What it means
The layout Manager's second layout pass wraps a failure of an individual column's Layout call (element.Layout for a left-to-right column such as the LayerDetailsCompoundLayout or the filetree column). The %s is the column element name. The underlying error almost always originates inside that column's own Layout (e.g. 'unable to layout %q' from the compound layout, or a view Setup failure).
Source
Thrown at cmd/dive/cli/internal/ui/v1/layout/manager.go:138
if variableColumns == 0 {
variableColumns = 1
widths[len(widths)-1] = -1
}
defaultWidth := availableWidth / variableColumns
// second pass: layout columns left to right (based off predetermined widths)
for idx, element := range elements {
// use the requested or default width
width := widths[idx]
if width == -1 {
width = defaultWidth
}
// layout the column within the allocated space
err := element.Layout(g, area.minX, area.minY, area.minX+width, area.maxY)
if err != nil {
return area, fmt.Errorf("failed to layout '%s' column: %w", element.Name(), err)
}
// move left to right, scratching off real estate as it is taken
area.minX += width
}
}
return area, nil
}
func (lm *Manager) layoutFooters(g *gocui.Gui, area Area, footerHeights []int) error {
// 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]View on GitHub (pinned to d6c691947f)
Solutions
- Widen/heighten the terminal and let the next layout pass run
- Read the wrapped error — it names the failing column and carries the root cause; fix that column's specific error (Setup, SetView)
- If a custom column requests a fixed width via RequestedSize, make sure it fits or return nil for a default width
- Guard tests/embeddings by checking terminal dimensions before starting the UI loop
Example fix
// before starting the TUI, validate the screen is big enough
w, h := gui.Size()
if w < 80 || h < 10 {
return fmt.Errorf("terminal too small (%dx%d); resize and retry", w, h)
} Defensive patterns
Strategy: try-catch
Validate before calling
// ensure requested column widths fit the screen before layout
if width > area.maxX-area.minX { width = defaultWidth } Try / catch
area, err := lm.layoutColumns(g, area, widths)
if err != nil {
return area, fmt.Errorf("column layout failed (likely terminal too small): %w", err)
} Prevention
- Return sane widths from RequestedSize (or nil for default)
- Validate terminal size before entering MainLoop
- Test layout managers with 1x1 and 0-size areas in unit tests
When it happens
Trigger: Any column element's Layout returning an error: gocui SetView geometry errors when the allocated width/height is degenerate (terminal too small, a column requesting more width than the screen via RequestedSize), or a view controller's Setup failing during first-time view creation.
Common situations: Terminal narrower than the sum of the columns' requested/default widths; extreme window shrink during resize events; keybinding conflicts raised during a view's Setup; running dive with a UI-affecting config against a very small pty.
Related errors
- unable to layout %q: %w
- failed to set UI: %w
- failed to set UI: %w
- failed to layout %q footer: %w
- unable to move the cursor, empty line
AI-assisted analysis of wagoodman/dive@d6c691947f (2026-08-15).
Data as JSON: /api/errors/f756a7fdc67702ad.
Report an issue: GitHub.