derailed/k9s · error

unable to run command

Error message

unable to run command

What it means

runK() calls run(a, opts), which for foreground commands does a.Suspend(fn) — suspending the tview application so the child process can own the terminal. Suspend returns false when the app cannot suspend (already suspended, halted, or mid-teardown), and k9s then reports 'unable to run command' because the process was never started. Note this is a plain error with no %w — no underlying cause is attached.

Source

Thrown at internal/view/exec.go:87

	}
	if g, err := a.Conn().Config().ImpersonateGroups(); err == nil {
		args = append(args, "--as-group", g)
	}
	if isInsecure := a.Conn().Config().Flags().Insecure; isInsecure != nil && *isInsecure {
		args = append(args, "--insecure-skip-tls-verify")
	}
	args = append(args, "--context", a.Config.K9s.ActiveContextName())
	if cfg := a.Conn().Config().Flags().KubeConfig; cfg != nil && *cfg != "" {
		args = append(args, "--kubeconfig", *cfg)
	}
	if len(args) > 0 {
		opts.args = append(args, opts.args[1:]...)
	}
	opts.binary = bin

	suspended, errChan, stChan := run(a, opts)
	if !suspended {
		return fmt.Errorf("unable to run command")
	}
	for v := range stChan {
		slog.Debug("stdout", slogs.Line, v)
	}
	var errs error
	for e := range errChan {
		errs = errors.Join(errs, e)
	}

	return errs
}

func run(a *App, opts *shellOpts) (ok bool, errC chan error, outC chan string) {
	errChan := make(chan error, 1)
	statusChan := make(chan string, 1)

	if opts.background {
		if err := execute(opts, statusChan); err != nil {

View on GitHub (pinned to 2d3ccc6ba2)

Solutions

  1. Wait for the UI to be responsive, then retry the command — transient suspend contention resolves itself
  2. Avoid firing multiple shell/exec actions in quick succession (one at a time)
  3. If it persists, restart k9s — a stuck suspend state clears on restart
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: Two kubectl-shelling actions racing (e.g. double keypress firing 's' twice, or a plugin exec concurrent with a shell command); invoking a shell-out while the app is halting/resuming; any state where the tapp is not in a suspendable state.

Common situations: Impatient double-presses of shell keys; plugins that shell out while a built-in shell session is active; slow terminals where suspend takes longer than the user's next keypress.

Related errors


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