derailed/k9s · warning

you must provide a selection

Error message

you must provide a selection

What it means

Returned by `Job.logOptions` (internal/view/job.go:~58) when the jobs table has no selected item. The logs shortcut needs a job name to fetch the Job and derive log options from its pod template; empty selection aborts here before `getInstance` runs.

Source

Thrown at internal/view/job.go:58

	if err != nil {
		app.Flash().Err(err)
		return
	}

	var job batchv1.Job
	err = runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &job)
	if err != nil {
		app.Flash().Err(err)
		return
	}

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

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

	return podLogOptions(j.App(), path, prev, &job.ObjectMeta, &job.Spec.Template.Spec), nil
}

func (j *Job) getInstance(fqn string) (*batchv1.Job, error) {
	var job dao.Job
	job.Init(j.App().factory, client.JobGVR)

	return job.GetInstance(fqn)
}

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Highlight a job row before pressing the logs key
  2. Clear filters; also check `kubectl get jobs -n <ns>` to confirm jobs exist
  3. Look in the pods view instead if the job's pods outlived the job object
  4. Adjust failedJobsHistoryLimit/successfulJobsHistoryLimit if jobs vanish too fast
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Pressing the logs key on the jobs view with GetSelectedItem()=="" — empty job list, active filter hiding every row, or no row highlighted.

Common situations: Namespace has no jobs (they are transient); CronJob-created jobs already cleaned by history limits; filters excluding all rows.

Related errors


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