derailed/k9s · warning

you must provide a selection

Error message

you must provide a selection

What it means

Returned by `StatefulSet.logOptions` (internal/view/sts.go:~44) when the statefulset table has no selected item. The logs shortcut needs a statefulset name to fetch and derive log options from its pod template; with an empty selection it aborts before `getInstance`.

Source

Thrown at internal/view/sts.go:44

				NewScaleExtender(
					NewImageExtender(
						NewOwnerExtender(
							NewLogsExtender(NewBrowser(gvr), s.logOptions),
						),
					),
				),
			),
		),
	)
	s.GetTable().SetEnterFn(s.showPods)

	return &s
}

func (s *StatefulSet) logOptions(prev bool) (*dao.LogOptions, error) {
	path := s.GetTable().GetSelectedItem()
	if path == "" {
		return nil, errors.New("you must provide a selection")
	}
	sts, err := s.getInstance(path)
	if err != nil {
		return nil, err
	}

	return podLogOptions(s.App(), path, prev, &sts.ObjectMeta, &sts.Spec.Template.Spec), nil
}

func (s *StatefulSet) showPods(app *App, _ ui.Tabular, _ *client.GVR, path string) {
	i, err := s.getInstance(path)
	if err != nil {
		app.Flash().Err(err)
		return
	}

	showPodsFromSelector(app, path, i.Spec.Selector)
}

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Highlight a statefulset row, then press the logs key
  2. Clear active filters
  3. Confirm statefulsets exist: `kubectl get sts -n <ns>`
  4. Use the pods view for per-pod logs if preferred
Defensive patterns

Strategy: validation

Validate before calling

if s.GetTable().GetSelectedItem() == "" {
    s.App().Flash().Warnf("You must select a statefulset")
    return nil
}

Prevention

When it happens

Trigger: Pressing the logs key on the statefulsets view while GetSelectedItem()=="" (empty list, filter hiding all rows, or no highlight).

Common situations: Namespace without statefulsets; filters excluding everything; key pressed during table refresh before selection is restored.

Related errors


AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15). Data as JSON: /api/errors/b016d5c14ba50e02. Report an issue: GitHub.