{"record":{"id":"41800e8495e25941","repo":"derailed/k9s","slug":"missing-resource-name-in-path-q","errorCode":null,"errorMessage":"missing resource name in path %q","messagePattern":"missing resource name in path %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/view/browser.go","lineNumber":561,"sourceCode":"\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 {\n\t\tapp.Flash().Errf(\"Edit command failed: %s\", err)\n\t}\n\n\treturn nil","sourceCodeStart":543,"sourceCodeEnd":579,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/view/browser.go#L543-L579","documentation":"The selected path was non-empty but client.Namespaced(path) could not extract a resource name — the path is malformed, e.g. only a namespace (\"myns\") or a trailing-slash form (\"myns/\"). The name segment is required to build the kubectl edit target gvr.FQN(n).","triggerScenarios":"Path strings like \"default/\", \"/\", \"ns-only\", or paths with extra separators that make the name component empty. Produced by custom rows whose Path/ID column is populated from a field that lacks the name, or by a row representing a grouping/header node.","commonSituations":"Custom resource views where the ID column holds a namespace or label instead of ns/name; resources whose metadata.name is empty in the cached object; separators/dupes introduced by string joins in custom decorators.","solutions":["Inspect the selected row's Path column; fix the producer so it always sets path to ns/name (name from object meta.name).","Skip edit (and other row actions) for non-resource rows such as grouping headers.","If a custom column decorator builds the path, sanitize: strings.TrimSuffix(path, \"/\") and verify both segments non-empty."],"exampleFix":"// before\nrow.Path = ns\n\n// after\nrow.Path = ns + \"/\" + name","handlingStrategy":"validation","validationCode":"ns, n := client.Namespaced(path)\nif n == \"\" {\n    return fmt.Errorf(\"refusing edit: no name in path %q\", path)\n}","typeGuard":null,"tryCatchPattern":"if err := editRes(app, gvr, path); err != nil && strings.Contains(err.Error(), \"missing resource name\") {\n    slog.Error(\"malformed selection path\", \"path\", path)\n}","preventionTips":["Always build row paths as ns + \"/\" + metadata.name at row-construction time.","Add a shared helper isResourcePath(s string) bool checking two non-empty segments, and use it before row actions.","Skip actions on grouping/header rows that have no name segment."],"tags":["go","kubernetes","ui","path-parsing","edit"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}