derailed/k9s · warning

nothing selected

Error message

nothing selected

What it means

Returned by `Container.logOptions` (internal/view/container.go:~108) when the container table has no selected row (`GetTable().GetSelectedItem()` returns ""). The logs command (`l` / `p` for previous) needs a container path to build `dao.LogOptions`; with an empty selection it fails fast instead of fetching logs for nothing.

Source

Thrown at internal/view/container.go:108

	aa.Bulk(ui.KeyMap{
		ui.KeyF:      ui.NewKeyAction("Show PortForward", c.showPFCmd, true),
		ui.KeyShiftF: ui.NewKeyAction("PortForward", c.portFwdCmd, true),
	})
}

func (c *Container) k9sEnv() Env {
	path := c.GetTable().GetSelectedItem()
	row := c.GetTable().GetSelectedRow(path)
	env := defaultEnv(c.App().Conn().Config(), path, c.GetTable().GetModel().Peek().Header(), row)
	env["NAMESPACE"], env["POD"] = client.Namespaced(c.GetTable().Path)

	return env
}

func (c *Container) logOptions(prev bool) (*dao.LogOptions, error) {
	path := c.GetTable().GetSelectedItem()
	if path == "" {
		return nil, errors.New("nothing selected")
	}

	cfg := c.App().Config.K9s.Logger
	opts := dao.LogOptions{
		Path:            c.GetTable().Path,
		Container:       path,
		Lines:           cfg.TailCount,
		SinceSeconds:    cfg.SinceSeconds,
		SingleContainer: true,
		ShowTimestamp:   cfg.ShowTime,
		Previous:        prev,
	}

	return &opts, nil
}

func (c *Container) viewLogs(*App, ui.Tabular, *client.GVR, string) {
	c.ResourceViewer.(*LogsExtender).showLogs(c.GetTable().Path, false)

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Make sure the container list is non-empty and a row is highlighted before pressing `l`
  2. Clear any active filter that hides all rows (`/` then Esc)
  3. If the container list is empty, the pod has no reportable containers — inspect it with `kubectl describe pod`
  4. Use `p` only after selecting a container when you want previous (crashed) instance logs
Defensive patterns

Strategy: validation

Validate before calling

if c.GetTable().GetSelectedItem() == "" {
    c.App().Flash().Warnf("Select a container first")
    return nil
}

Prevention

When it happens

Trigger: Pressing the logs key (or shift-l for previous logs) on the container view while no row is selected — e.g. empty container list, filter that removed all rows, or focus lost before the keypress.

Common situations: Pod has a single init container that finished and the list is empty; a filter (`/`) excluded every row; user hits `l` immediately after entering the view before selection settles.

Related errors


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