{"record":{"id":"345679973db4407b","repo":"wagoodman/dive","slug":"unable-to-setup-filter-controller-w","errorCode":null,"errorMessage":"unable to setup filter controller: %w","messagePattern":"unable to setup filter controller: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/dive/cli/internal/ui/v1/view/filter.go","lineNumber":180,"sourceCode":"// OnLayoutChange is called whenever the screen dimensions are changed\nfunc (v *Filter) OnLayoutChange() error {\n\terr := v.Update()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn v.Render()\n}\n\nfunc (v *Filter) 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\tlabel, labelErr := g.SetView(v.Name()+\"label\", minX, minY, len(v.labelStr), maxY, 0)\n\tview, viewErr := g.SetView(v.Name(), minX+(len(v.labelStr)-1), minY, maxX, maxY, 0)\n\n\tif utils.IsNewView(viewErr, labelErr) {\n\t\terr := v.Setup(view, label)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to setup filter controller: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (v *Filter) RequestedSize(available int) *int {\n\treturn &v.requestedHeight\n}\n","sourceCodeStart":162,"sourceCodeEnd":189,"githubUrl":"https://github.com/wagoodman/dive/blob/d6c691947f8fda635c952a17ee3b7555379d58f0/cmd/dive/cli/internal/ui/v1/view/filter.go#L162-L189","documentation":"Raised in the filter view's Layout when Filter.Setup fails on first-time creation of the 'filter' label and input views. Setup configures the editor and view options for the path-filter input line; any error from that setup (or its initial render) is wrapped here. The filter view's geometry depends on len(v.labelStr), so degenerate label widths or tiny terminals can produce bad SetView coordinates upstream.","triggerScenarios":"utils.IsNewView true for the filter/label views and Filter.Setup returning non-nil — e.g. editor/keybinding wiring failing, or the initial header render erroring because the label view was created with a degenerate rectangle (len(v.labelStr) small vs minX).","commonSituations":"Custom forks modifying the filter label; terminals too narrow for the label plus input area; shutdown races during first layout; running non-stock builds with extra Setup logic.","solutions":["Check the wrapped error for the concrete Setup failure","Use a wider terminal (the label plus input need several columns)","If you changed the filter label string, ensure its length leaves room (maxX > minX + len(label) - 1)","Report upstream if reproducible in stock dive"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// ensure the label leaves room for the input area\nif maxX <= minX+len(v.labelStr) { return nil }","typeGuard":null,"tryCatchPattern":"if err := v.Setup(view, label); err != nil {\n    return fmt.Errorf(\"unable to setup filter controller: %w\", err)\n}","preventionTips":["Keep the filter label short if customizing","Ensure terminals are wide enough for label + input","Avoid deleting the filter views mid-session"],"tags":["ui","gocui","filter","setup"],"backgroundTag":null,"analyzedSha":"d6c691947f8fda635c952a17ee3b7555379d58f0","analyzedAt":"2026-08-15T09:42:35.293Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}