derailed/k9s · warning

`%s` command not found

Error message

`%s` command not found

What it means

The alias resolver rejected the command token p.Cmd(): it matches neither a resource short/full name, a configured alias, nor a built-in command. The app uses aliases as its command vocabulary, so an unresolvable token cannot be mapped to a viewer.

Source

Thrown at internal/view/command.go:321

		if a, ok := p.DirArg(); !ok {
			c.app.Flash().Errf("Invalid command. Use `dir xxx`")
		} else if err := c.app.dirCmd(a, pushCmd); err != nil {
			c.app.Flash().Err(err)
		}
	default:
		return false
	}

	return true
}

func (c *Command) viewMetaFor(p *cmd.Interpreter) (*client.GVR, *MetaViewer, *cmd.Interpreter, error) {
	if c.alias == nil {
		return client.NoGVR, nil, nil, fmt.Errorf("no connection available")
	}
	gvr, ok := c.alias.Resolve(p)
	if !ok {
		return client.NoGVR, nil, nil, fmt.Errorf("`%s` command not found", p.Cmd())
	}

	v := MetaViewer{
		viewerFn: func(gvr *client.GVR) ResourceViewer {
			return NewScaleExtender(NewOwnerExtender(NewBrowser(gvr)))
		},
	}
	if mv, ok := customViewers[gvr]; ok {
		v = mv
	}

	return gvr, &v, p, nil
}

func (*Command) componentFor(gvr *client.GVR, fqn string, v *MetaViewer) ResourceViewer {
	var view ResourceViewer
	if v.viewerFn != nil {
		view = v.viewerFn(gvr)

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Use canonical short names: po, svc, dp, ds, sts, rs, ing, cm, ns, and built-ins like ctx, xray, alias.
  2. List/define aliases: open the alias view or add entries under the aliases section of the config.
  3. If the command came from history, clear/ignore it after alias changes.

Example fix

# before
:pod

# after
:po
Defensive patterns

Strategy: validation

Validate before calling

if _, ok := c.alias.Resolve(p); !ok {
    return fmt.Errorf("unknown command %q — check aliases with the alias view", p.Cmd())
}

Prevention

When it happens

Trigger: Typing :pod instead of :po, :ingress vs :ing mismatches, :mycustomcmd with no alias defined; tokens that exist as kubectl names but not as app aliases; stale command history replayed after aliases were removed from config.

Common situations: New users guessing command names; aliases customized per cluster/user config; upgrades renaming/removing aliases; deleted aliases still present in cmdHistory.

Related errors


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