{"record":{"id":"ed78c71b8d6eef6e","repo":"wagoodman/dive","slug":"unable-to-setup-debug-controller-w","errorCode":null,"errorMessage":"unable to setup debug controller: %w","messagePattern":"unable to setup debug controller: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/dive/cli/internal/ui/v1/view/debug.go","lineNumber":116,"sourceCode":"\t\treturn nil\n\t})\n\treturn nil\n}\n\nfunc (v *Debug) Layout(g *gocui.Gui, minX, minY, maxX, maxY int) error {\n\tv.logger.Tracef(\"layout(minX: %d, minY: %d, maxX: %d, maxY: %d)\", minX, minY, maxX, maxY)\n\n\t// header\n\theaderSize := 1\n\t// note: maxY needs to account for the (invisible) border, thus a +1\n\theader, headerErr := g.SetView(v.Name()+\"header\", minX, minY, maxX, minY+headerSize+1, 0)\n\t// we are going to overlap the view over the (invisible) border (so minY will be one less than expected).\n\t// additionally, maxY will be bumped by one to include the border\n\tview, viewErr := g.SetView(v.Name(), minX, minY+headerSize, maxX, maxY+1, 0)\n\tif utils.IsNewView(viewErr, headerErr) {\n\t\terr := v.Setup(view, header)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to setup debug controller: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (v *Debug) RequestedSize(available int) *int {\n\treturn nil\n}\n","sourceCodeStart":98,"sourceCodeEnd":125,"githubUrl":"https://github.com/wagoodman/dive/blob/d6c691947f8fda635c952a17ee3b7555379d58f0/cmd/dive/cli/internal/ui/v1/view/debug.go#L98-L125","documentation":"Raised in the debug footer view's Layout when Debug.Setup fails on first-time view creation (utils.IsNewView true). Setup assigns view options and calls Render(); in the current code Render always returns nil, so this wrap only triggers if Setup is extended or panics are converted to errors. It is effectively a defensive wrapper around future/debug setup logic.","triggerScenarios":"g.SetView succeeding for 'debug'/'debugheader' but Debug.Setup(view, header) returning non-nil. Today Setup only sets Editable/Wrap/Frame and calls Render (which returns nil), so the error path requires a code change or a write failure surfacing from Render in a modified build.","commonSituations":"Custom forks that add keybindings or writes to the debug view during Setup; running a modified dive build where Debug.Render can fail; extremely small terminals where the header view is degenerate.","solutions":["If running a fork, check what Debug.Setup does in your build — stock dive cannot produce this error","Verify the debug view geometry is sane (maxY+1 > minY) on tiny terminals","If you see it in stock dive, report it upstream with the wrapped error text","Ensure the terminal is a real TTY with adequate size"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := v.Setup(view, header); err != nil {\n    return fmt.Errorf(\"unable to setup debug controller: %w\", err)\n}","preventionTips":["In forks, keep Debug.Setup side-effect free or return nil for cosmetic failures","Verify debug view geometry on small terminals"],"tags":["ui","gocui","debug","defensive"],"backgroundTag":null,"analyzedSha":"d6c691947f8fda635c952a17ee3b7555379d58f0","analyzedAt":"2026-08-15T09:42:35.293Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}