derailed/k9s · warning

unsupported resource %q

Error message

unsupported resource %q

What it means

The argument resolved to a GVR, but allowedXRay(gvr) is false: xray is only implemented for a fixed set of workload-ish resources (the allowedCmds set — pods, services, deployments, daemonsets, statefulsets, replicasets and friends). Any other resource, even valid ones like jobs or nodes, is rejected.

Source

Thrown at internal/view/command.go:159

	v.SetFilter(filter, true)

	return c.exec(p, client.AliGVR, v, false, pushCmd)
}

func (c *Command) xrayCmd(p *cmd.Interpreter, pushCmd bool) error {
	arg, cns, ok := p.XrayArgs()
	if !ok {
		return errors.New("invalid command. use `xray xxx`")
	}
	if c.alias == nil {
		return fmt.Errorf("no connection available")
	}
	gvr, ok := c.alias.Resolve(cmd.NewInterpreter(arg))
	if !ok {
		return fmt.Errorf("invalid resource name: %q", arg)
	}
	if !allowedXRay(gvr) {
		return fmt.Errorf("unsupported resource %q", arg)
	}
	ns := c.app.Config.ActiveNamespace()
	if cns != "" {
		ns = cns
	}
	if err := c.app.Config.SetActiveNamespace(client.CleanseNamespace(ns)); err != nil {
		return err
	}
	if err := c.app.switchNS(ns); err != nil {
		return err
	}

	return c.exec(p, client.XGVR, NewXray(gvr), true, pushCmd)
}

// Run execs the command by showing associated display.
func (c *Command) run(p *cmd.Interpreter, fqn string, clearStack, pushCmd bool) error {
	if c.specialCmd(p, pushCmd) {

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Use xray only on supported resources: pods, services, deployments, daemonsets, statefulsets, replicasets (see allowedCmds).
  2. For other resources, browse normally or use owner/reference navigation instead of xray.
  3. If you control a fork, extend the allowedCmds set and implement the xray view for the GVR.

Example fix

# before
:xray nodes

# after
:xray po
Defensive patterns

Strategy: validation

Validate before calling

gvr, ok := c.alias.Resolve(cmd.NewInterpreter(arg))
if ok && !allowedXRay(gvr) {
    return fmt.Errorf("xray supports only %v", allowedCmds.List())
}

Type guard

func xraySupported(gvr *client.GVR) bool { return allowedCmds.Has(gvr) }

Prevention

When it happens

Trigger: Running xray on resources outside the allowlist, e.g. `xray no` (nodes), `xray job`, `xray cm`, or a CRD. The resolver succeeds, then the set-membership check fails.

Common situations: Users assuming xray works for all resources; custom resources that resemble workloads; version changes that shrink/shift the allowlist.

Related errors


AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15). Data as JSON: /api/errors/f7d958348882cf75. Report an issue: GitHub.