{"record":{"id":"b016d5c14ba50e02","repo":"derailed/k9s","slug":"you-must-provide-a-selection-b016d5","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/sts.go","lineNumber":44,"sourceCode":"\t\t\t\tNewScaleExtender(\n\t\t\t\t\tNewImageExtender(\n\t\t\t\t\t\tNewOwnerExtender(\n\t\t\t\t\t\t\tNewLogsExtender(NewBrowser(gvr), s.logOptions),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\t),\n\t)\n\ts.GetTable().SetEnterFn(s.showPods)\n\n\treturn &s\n}\n\nfunc (s *StatefulSet) logOptions(prev bool) (*dao.LogOptions, error) {\n\tpath := s.GetTable().GetSelectedItem()\n\tif path == \"\" {\n\t\treturn nil, errors.New(\"you must provide a selection\")\n\t}\n\tsts, err := s.getInstance(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn podLogOptions(s.App(), path, prev, &sts.ObjectMeta, &sts.Spec.Template.Spec), nil\n}\n\nfunc (s *StatefulSet) showPods(app *App, _ ui.Tabular, _ *client.GVR, path string) {\n\ti, err := s.getInstance(path)\n\tif err != nil {\n\t\tapp.Flash().Err(err)\n\t\treturn\n\t}\n\n\tshowPodsFromSelector(app, path, i.Spec.Selector)\n}","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/view/sts.go#L26-L62","documentation":"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`.","triggerScenarios":"Pressing the logs key on the statefulsets view while GetSelectedItem()==\"\" (empty list, filter hiding all rows, or no highlight).","commonSituations":"Namespace without statefulsets; filters excluding everything; key pressed during table refresh before selection is restored.","solutions":["Highlight a statefulset row, then press the logs key","Clear active filters","Confirm statefulsets exist: `kubectl get sts -n <ns>`","Use the pods view for per-pod logs if preferred"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if s.GetTable().GetSelectedItem() == \"\" {\n    s.App().Flash().Warnf(\"You must select a statefulset\")\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Highlight a statefulset row before logs","Confirm sts exists in namespace","Clear filters"],"tags":["ui","selection","logs","statefulset","k9s"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}