derailed/k9s · warning

you must provide a selection

Error message

you must provide a selection

What it means

Returned by `Pod.logOptions` (internal/view/pod.go:~139) when the pods table has no selected item. k9s needs the pod path to `fetchPod` and build `dao.LogOptions`; an empty selection short-circuits with this error.

Source

Thrown at internal/view/pod.go:139

				Dangerous: true,
			}),
	})
}

func (p *Pod) bindKeys(aa *ui.KeyActions) {
	if !p.App().Config.IsReadOnly() {
		p.bindDangerousKeys(aa)
	}

	aa.Bulk(ui.KeyMap{
		ui.KeyO: ui.NewKeyAction("Show Node", p.showNode, true),
	})
}

func (p *Pod) logOptions(prev bool) (*dao.LogOptions, error) {
	path := p.GetTable().GetSelectedItem()
	if path == "" {
		return nil, errors.New("you must provide a selection")
	}

	pod, err := fetchPod(p.App().factory, path)
	if err != nil {
		return nil, err
	}

	return podLogOptions(p.App(), path, prev, &pod.ObjectMeta, &pod.Spec), nil
}

func (p *Pod) showContainers(app *App, _ ui.Tabular, _ *client.GVR, _ string) {
	co := NewContainer(client.CoGVR)
	co.SetContextFn(p.coContext)
	if err := app.inject(co, false); err != nil {
		app.Flash().Err(err)
	}
}

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Select (highlight) a pod row first, then press `l`
  2. Clear any active filter (`/` then Esc)
  3. Confirm pods exist: `kubectl get pods -n <ns>`
  4. If the list is empty due to RBAC, verify list permissions for pods in that namespace
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Pressing the logs key (`l` or shift-`p`) on the pod view while GetSelectedItem() returns "" — empty pod list, filter hiding all rows, or selection not yet established.

Common situations: Namespace with zero pods; label/field filter excludes everything; pressing the key right after entering the view or during a table refresh.

Related errors


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