{"record":{"id":"f756a7fdc67702ad","repo":"wagoodman/dive","slug":"failed-to-layout-s-column-w","errorCode":null,"errorMessage":"failed to layout '%s' column: %w","messagePattern":"failed to layout '(.+?)' column: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/dive/cli/internal/ui/v1/layout/manager.go","lineNumber":138,"sourceCode":"\t\tif variableColumns == 0 {\n\t\t\tvariableColumns = 1\n\t\t\twidths[len(widths)-1] = -1\n\t\t}\n\n\t\tdefaultWidth := availableWidth / variableColumns\n\n\t\t// second pass: layout columns left to right (based off predetermined widths)\n\t\tfor idx, element := range elements {\n\t\t\t// use the requested or default width\n\t\t\twidth := widths[idx]\n\t\t\tif width == -1 {\n\t\t\t\twidth = defaultWidth\n\t\t\t}\n\n\t\t\t// layout the column within the allocated space\n\t\t\terr := element.Layout(g, area.minX, area.minY, area.minX+width, area.maxY)\n\t\t\tif err != nil {\n\t\t\t\treturn area, fmt.Errorf(\"failed to layout '%s' column: %w\", element.Name(), err)\n\t\t\t}\n\n\t\t\t// move left to right, scratching off real estate as it is taken\n\t\t\tarea.minX += width\n\t\t}\n\t}\n\treturn area, nil\n}\n\nfunc (lm *Manager) layoutFooters(g *gocui.Gui, area Area, footerHeights []int) error {\n\t// layout footers top down (which is why the list is reversed). Top down is needed due to border overlap.\n\tif elements, exists := lm.elements[LocationFooter]; exists {\n\t\tfor idx := len(elements) - 1; idx >= 0; idx-- {\n\t\t\telement := elements[idx]\n\t\t\theight := footerHeights[idx]\n\t\t\tvar topY, bottomY, bottomPadding int\n\t\t\tfor oIdx := 0; oIdx <= idx; oIdx++ {\n\t\t\t\tbottomPadding += footerHeights[oIdx]","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/wagoodman/dive/blob/d6c691947f8fda635c952a17ee3b7555379d58f0/cmd/dive/cli/internal/ui/v1/layout/manager.go#L120-L156","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before starting the TUI, validate the screen is big enough\nw, h := gui.Size()\nif w < 80 || h < 10 {\n    return fmt.Errorf(\"terminal too small (%dx%d); resize and retry\", w, h)\n}","handlingStrategy":"try-catch","validationCode":"// ensure requested column widths fit the screen before layout\nif width > area.maxX-area.minX { width = defaultWidth }","typeGuard":null,"tryCatchPattern":"area, err := lm.layoutColumns(g, area, widths)\nif err != nil {\n    return area, fmt.Errorf(\"column layout failed (likely terminal too small): %w\", err)\n}","preventionTips":["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"],"tags":["ui","gocui","layout","terminal"],"backgroundTag":null,"analyzedSha":"d6c691947f8fda635c952a17ee3b7555379d58f0","analyzedAt":"2026-08-15T09:42:35.293Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}