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
- Wait for the UI to be responsive, then retry the command — transient suspend contention resolves itself
- Avoid firing multiple shell/exec actions in quick succession (one at a time)
- If it persists, restart k9s — a stuck suspend state clears on restart
Defensive patterns
Strategy: retry
Prevention
- Fire one exec action at a time; wait for the TUI to resume before the next
- If suspend fails once, wait a beat and retry — contention is transient
- Restart k9s if the app seems stuck in a suspended state (no shell, unresponsive keys)
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
- failed to inject target view: %w
- kubectl command must not be in the current working directory
- kubectl command is not in your path: %w
- shell exec failed: %w
- command failed. Check k9s logs: %w
AI-assisted analysis of derailed/k9s@2d3ccc6ba2 (2026-08-15).
Data as JSON: /api/errors/bef52f2d1aeee971.
Report an issue: GitHub.