{"record":{"id":"e683bf3363648ff7","repo":"derailed/k9s","slug":"invalid-resource-name-q","errorCode":null,"errorMessage":"invalid resource name: %q","messagePattern":"invalid resource name: %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/view/command.go","lineNumber":156,"sourceCode":"\tfilter, _ := p.FilterArg()\n\n\tv := NewAlias(client.AliGVR)\n\tv.SetFilter(filter, true)\n\n\treturn c.exec(p, client.AliGVR, v, false, pushCmd)\n}\n\nfunc (c *Command) xrayCmd(p *cmd.Interpreter, pushCmd bool) error {\n\targ, cns, ok := p.XrayArgs()\n\tif !ok {\n\t\treturn errors.New(\"invalid command. use `xray xxx`\")\n\t}\n\tif c.alias == nil {\n\t\treturn fmt.Errorf(\"no connection available\")\n\t}\n\tgvr, ok := c.alias.Resolve(cmd.NewInterpreter(arg))\n\tif !ok {\n\t\treturn fmt.Errorf(\"invalid resource name: %q\", arg)\n\t}\n\tif !allowedXRay(gvr) {\n\t\treturn fmt.Errorf(\"unsupported resource %q\", arg)\n\t}\n\tns := c.app.Config.ActiveNamespace()\n\tif cns != \"\" {\n\t\tns = cns\n\t}\n\tif err := c.app.Config.SetActiveNamespace(client.CleanseNamespace(ns)); err != nil {\n\t\treturn err\n\t}\n\tif err := c.app.switchNS(ns); err != nil {\n\t\treturn err\n\t}\n\n\treturn c.exec(p, client.XGVR, NewXray(gvr), true, pushCmd)\n}\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/view/command.go#L138-L174","documentation":"The alias resolver (built from cluster discovery and user alias config) could not map the xray argument to a GVR. The token is not a known resource short name, full name, or configured alias, so there is nothing to x-ray.","triggerScenarios":"Running `xray deploymnt` (typo), `xray mycustomthing` where the CRD is not installed, or a resource name valid on another cluster but absent here because the RESTMapper/discovery data differs.","commonSituations":"Typos and wrong short-names; CRDs not yet installed or discovery cache stale after installing a CRD; per-cluster alias differences; aliases defined in config for one cluster only.","solutions":["Use a canonical short name: xray po, xray svc, xray dp, xray ds, xray sts, xray rs.","List what resolves: check your aliases (alias command / config aliases section) and kubectl api-resources for installed types.","Reconnect/restart so discovery refreshes if the CRD was just installed.","Fix typos; note some resources are named differently across API groups."],"exampleFix":"# before\n:xray deploymnt\n\n# after\n:xray dp","handlingStrategy":"validation","validationCode":"if c.alias == nil { return fmt.Errorf(\"no connection available\") }\ngvr, ok := c.alias.Resolve(cmd.NewInterpreter(arg))\nif !ok {\n    return fmt.Errorf(\"unknown resource %q — try po, svc, dp, ds, sts, rs; list types via kubectl api-resources\", arg)\n}","typeGuard":null,"tryCatchPattern":"if err := c.xrayCmd(p, push); err != nil {\n    if strings.Contains(err.Error(), \"invalid resource name\") {\n    suggestCanonicalNames(arg)\n    }\n}","preventionTips":["Memorize the short-name set (po/svc/dp/ds/sts/rs) for xray targets.","Reconnect after installing CRDs so discovery/alias caches refresh.","Keep per-cluster alias config in version control so teams share a vocabulary."],"tags":["xray","alias","command","usage"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}