{"record":{"id":"f65be7423c9c6e08","repo":"wagoodman/dive","slug":"notifyonviewoptionchangelisteners-error-w","errorCode":null,"errorMessage":"notifyOnViewOptionChangeListeners error: %w","messagePattern":"notifyOnViewOptionChangeListeners error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/dive/cli/internal/ui/v1/view/filetree.go","lineNumber":355,"sourceCode":"\n\terr := v.Update()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = v.Render()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// we need to render the changes to the status pane as well (not just this contoller/view)\n\treturn v.notifyOnViewOptionChangeListeners()\n}\n\nfunc (v *FileTree) notifyOnViewOptionChangeListeners() error {\n\tfor _, listener := range v.listeners {\n\t\terr := listener()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"notifyOnViewOptionChangeListeners error: %w\", err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// ToggleAttributes will show/hide file attributes\nfunc (v *FileTree) toggleAttributes() error {\n\terr := v.vm.ToggleAttributes()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = v.Update()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = v.Render()\n\tif err != nil {","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/wagoodman/dive/blob/d6c691947f8fda635c952a17ee3b7555379d58f0/cmd/dive/cli/internal/ui/v1/view/filetree.go#L337-L373","documentation":"FileTree.notifyOnViewOptionChangeListeners iterates registered listener callbacks (other views that must refresh when the filetree's display options change, e.g. the status pane re-rendering key help after toggling attributes or diff-type visibility) and wraps the first listener error. The error indicates a downstream view's Update/Render failed in reaction to a filetree option change, not the filetree itself.","triggerScenarios":"Calling toggleAttributes/toggleShowDiffType paths that end in notifyOnViewOptionChangeListeners, where a registered listener (e.g. a status/layer view refresh) returns an error such as a gocui write or view operation failing.","commonSituations":"Toggling file attributes (Ctrl+A) or hiding a diff type (Ctrl+R etc.) while the terminal is being resized or torn down; a listener view that was deleted racing with the option change; custom views added as listeners that can fail.","solutions":["Check the wrapped error — it comes from the listener view, not the filetree; fix that view's failure","Avoid resizing/closing the terminal while toggling view options","If adding custom listeners, make them defensive (log-and-continue) for non-critical refreshes","Reproduce with the same image in a stable terminal size to rule out geometry races"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := v.notifyOnViewOptionChangeListeners(); err != nil {\n    // option change already applied; log and continue rather than aborting the UI\n    v.logger.WithFields(\"error\", err).Warn(\"view option change listener failed\")\n}","preventionTips":["Register only refresh-idempotent listeners","Make listener callbacks defensive: log errors instead of propagating cosmetic render failures","Avoid resizing while toggling view options"],"tags":["ui","listeners","filetree","event-coupling"],"backgroundTag":null,"analyzedSha":"d6c691947f8fda635c952a17ee3b7555379d58f0","analyzedAt":"2026-08-15T09:42:35.293Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}