{"record":{"id":"d6a142d696c01725","repo":"derailed/k9s","slug":"nothing-selected-q","errorCode":null,"errorMessage":"nothing selected %q","messagePattern":"nothing selected %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/view/browser.go","lineNumber":557,"sourceCode":"\nfunc (b *Browser) editCmd(evt *tcell.EventKey) *tcell.EventKey {\n\tpath := b.GetSelectedItem()\n\tif path == \"\" {\n\t\treturn evt\n\t}\n\n\tb.Stop()\n\tdefer b.Start()\n\tif err := editRes(b.app, b.GVR(), path); err != nil {\n\t\tb.App().Flash().Err(err)\n\t}\n\n\treturn nil\n}\n\nfunc editRes(app *App, gvr *client.GVR, path string) error {\n\tif path == \"\" {\n\t\treturn fmt.Errorf(\"nothing selected %q\", path)\n\t}\n\tns, n := client.Namespaced(path)\n\tif n == \"\" {\n\t\treturn fmt.Errorf(\"missing resource name in path %q\", path)\n\t}\n\tif client.IsClusterScoped(ns) {\n\t\tns = client.BlankNamespace\n\t}\n\tif ok, err := app.Conn().CanI(ns, gvr, n, client.PatchAccess); !ok || err != nil {\n\t\treturn fmt.Errorf(\"current user can't edit resource %s\", gvr)\n\t}\n\n\targs := make([]string, 0, 10)\n\targs = append(args, \"edit\", gvr.FQN(n))\n\tif ns != client.BlankNamespace {\n\t\targs = append(args, \"-n\", ns)\n\t}\n\tif err := runK(app, &shellOpts{clear: true, args: args}); err != nil {","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/view/browser.go#L539-L575","documentation":"editRes was invoked with an empty selection path, meaning the edit command (`e`) ran while no row was selected in the browser. The path identifies the resource to edit (namespace/name); empty means there is nothing to send to kubectl edit.","triggerScenarios":"Pressing `e` in a browser view with zero rows, with the cursor on a header/blank line, or when the selected row's path failed to resolve (GetSelectedPath returned empty). Also occurs programmatically calling editRes(app, gvr, \"\").","commonSituations":"Empty or filtered-to-zero resource list; keybinding race where `e` fires before the table loads; headless/automated use that calls the edit command without a selection.","solutions":["Select a row first (arrow keys/mouse) before pressing `e`; verify the list actually has entries.","If automating, check b.GVR()/GetSelectedPath() returns non-empty before invoking edit.","If the list is unexpectedly empty, clear filters ( / filter text, Escape) so rows render."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"path := b.GetTable().GetSelectedPath()\nif path == \"\" {\n    b.App().Flash().Err(fmt.Errorf(\"select a row before editing\"))\n    return nil\n}\nreturn editRes(b.app, b.GVR(), path)","typeGuard":null,"tryCatchPattern":"if err := editRes(app, gvr, path); err != nil {\n    if strings.Contains(err.Error(), \"nothing selected\") {\n        app.Flash().Err(err) // user guidance, no retry needed\n    }\n}","preventionTips":["Guard every row-scoped command (edit/delete/describe) on a non-empty selection path.","Disable or no-op row keybindings when the table has zero rows.","In automation, assert GetSelectedPath() is non-empty before invoking edit commands."],"tags":["go","kubernetes","ui","selection","edit"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}