{"record":{"id":"dfba6e6be1657952","repo":"derailed/k9s","slug":"you-must-provide-a-selection-dfba6e","errorCode":null,"errorMessage":"you must provide a selection","messagePattern":"you must provide a selection","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/view/job.go","lineNumber":58,"sourceCode":"\tif err != nil {\n\t\tapp.Flash().Err(err)\n\t\treturn\n\t}\n\n\tvar job batchv1.Job\n\terr = runtime.DefaultUnstructuredConverter.FromUnstructured(o.(*unstructured.Unstructured).Object, &job)\n\tif err != nil {\n\t\tapp.Flash().Err(err)\n\t\treturn\n\t}\n\n\tshowPodsFromSelector(app, path, job.Spec.Selector)\n}\n\nfunc (j *Job) logOptions(prev bool) (*dao.LogOptions, error) {\n\tpath := j.GetTable().GetSelectedItem()\n\tif path == \"\" {\n\t\treturn nil, errors.New(\"you must provide a selection\")\n\t}\n\tjob, err := j.getInstance(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn podLogOptions(j.App(), path, prev, &job.ObjectMeta, &job.Spec.Template.Spec), nil\n}\n\nfunc (j *Job) getInstance(fqn string) (*batchv1.Job, error) {\n\tvar job dao.Job\n\tjob.Init(j.App().factory, client.JobGVR)\n\n\treturn job.GetInstance(fqn)\n}\n","sourceCodeStart":40,"sourceCodeEnd":74,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/view/job.go#L40-L74","documentation":"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.","triggerScenarios":"Pressing the logs key on the jobs view with GetSelectedItem()==\"\" — empty job list, active filter hiding every row, or no row highlighted.","commonSituations":"Namespace has no jobs (they are transient); CronJob-created jobs already cleaned by history limits; filters excluding all rows.","solutions":["Highlight a job row before pressing the logs key","Clear filters; also check `kubectl get jobs -n <ns>` to confirm jobs exist","Look in the pods view instead if the job's pods outlived the job object","Adjust failedJobsHistoryLimit/successfulJobsHistoryLimit if jobs vanish too fast"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if j.GetTable().GetSelectedItem() == \"\" {\n    j.App().Flash().Warnf(\"You must select a job\")\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Select a job row before logs","Raise job history limits if jobs disappear quickly","Use pods view for logs of finished jobs' pods"],"tags":["ui","selection","logs","job","k9s"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}