wagoodman/dive · error

notifyOnViewOptionChangeListeners error: %w

Error message

notifyOnViewOptionChangeListeners error: %w

What it means

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.

Source

Thrown at cmd/dive/cli/internal/ui/v1/view/filetree.go:355

	err := v.Update()
	if err != nil {
		return err
	}
	err = v.Render()
	if err != nil {
		return err
	}

	// we need to render the changes to the status pane as well (not just this contoller/view)
	return v.notifyOnViewOptionChangeListeners()
}

func (v *FileTree) notifyOnViewOptionChangeListeners() error {
	for _, listener := range v.listeners {
		err := listener()
		if err != nil {
			return fmt.Errorf("notifyOnViewOptionChangeListeners error: %w", err)
		}
	}
	return nil
}

// ToggleAttributes will show/hide file attributes
func (v *FileTree) toggleAttributes() error {
	err := v.vm.ToggleAttributes()
	if err != nil {
		return err
	}

	err = v.Update()
	if err != nil {
		return err
	}
	err = v.Render()
	if err != nil {

View on GitHub (pinned to d6c691947f)

Solutions

  1. Check the wrapped error — it comes from the listener view, not the filetree; fix that view's failure
  2. Avoid resizing/closing the terminal while toggling view options
  3. If adding custom listeners, make them defensive (log-and-continue) for non-critical refreshes
  4. Reproduce with the same image in a stable terminal size to rule out geometry races
Defensive patterns

Strategy: try-catch

Try / catch

if err := v.notifyOnViewOptionChangeListeners(); err != nil {
    // option change already applied; log and continue rather than aborting the UI
    v.logger.WithFields("error", err).Warn("view option change listener failed")
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of wagoodman/dive@d6c691947f (2026-08-15). Data as JSON: /api/errors/f65be7423c9c6e08. Report an issue: GitHub.