wagoodman/dive · error

controller unable to switch to previous pane: %w

Error message

controller unable to switch to previous pane: %w

What it means

Mirror of error 28 for PrevPane(): it cycles focus in reverse (Layer -> ImageDetails -> LayerDetails -> Layer) and wraps a failure of gocui SetCurrentView() when the target pane view cannot be made current. Same failure surface as NextPane, opposite direction.

Source

Thrown at cmd/dive/cli/internal/ui/v1/app/controller.go:195

//nolint:dupl
func (c *controller) PrevPane() (err error) {
	v := c.gui.CurrentView()
	if v == nil {
		panic("Current view is nil")
	}
	if v.Name() == c.views.Layer.Name() {
		_, err = c.gui.SetCurrentView(c.views.ImageDetails.Name())
		c.views.Status.SetCurrentView(c.views.ImageDetails)
	} else if v.Name() == c.views.LayerDetails.Name() {
		_, err = c.gui.SetCurrentView(c.views.Layer.Name())
		c.views.Status.SetCurrentView(c.views.Layer)
	} else if v.Name() == c.views.ImageDetails.Name() {
		_, err = c.gui.SetCurrentView(c.views.LayerDetails.Name())
		c.views.Status.SetCurrentView(c.views.LayerDetails)
	}

	if err != nil {
		return fmt.Errorf("controller unable to switch to previous pane: %w", err)
	}

	return c.UpdateAndRender()
}

// ToggleView switches between the file view and the layer view and re-renders the screen.
func (c *controller) ToggleView() (err error) {
	v := c.gui.CurrentView()
	if v == nil || v.Name() == c.views.Layer.Name() {
		_, err = c.gui.SetCurrentView(c.views.Tree.Name())
		c.views.Status.SetCurrentView(c.views.Tree)
	} else {
		_, err = c.gui.SetCurrentView(c.views.Layer.Name())
		c.views.Status.SetCurrentView(c.views.Layer)
	}

	if err != nil {
		return fmt.Errorf("controller unable to toggle view: %w", err)

View on GitHub (pinned to d6c691947f)

Solutions

  1. Let the TUI finish its initial layout before switching panes.
  2. Keep the terminal at a reasonable size; avoid minimizing/restoring mid-session.
  3. Upgrade dive to pick up view-lifecycle fixes.
  4. Reproduce with debug logging and report upstream if repeatable.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Pressing the previous-pane keybinding when the destination view is not registered with the gui (startup race, torn-down layout), producing a non-nil error from SetCurrentView.

Common situations: Fast keyboard input at startup; terminal resize destroying views; inconsistent view registration in modified builds.

Related errors


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