{"record":{"id":"bef52f2d1aeee971","repo":"derailed/k9s","slug":"unable-to-run-command","errorCode":null,"errorMessage":"unable to run command","messagePattern":"unable to run command","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/view/exec.go","lineNumber":87,"sourceCode":"\t}\n\tif g, err := a.Conn().Config().ImpersonateGroups(); err == nil {\n\t\targs = append(args, \"--as-group\", g)\n\t}\n\tif isInsecure := a.Conn().Config().Flags().Insecure; isInsecure != nil && *isInsecure {\n\t\targs = append(args, \"--insecure-skip-tls-verify\")\n\t}\n\targs = append(args, \"--context\", a.Config.K9s.ActiveContextName())\n\tif cfg := a.Conn().Config().Flags().KubeConfig; cfg != nil && *cfg != \"\" {\n\t\targs = append(args, \"--kubeconfig\", *cfg)\n\t}\n\tif len(args) > 0 {\n\t\topts.args = append(args, opts.args[1:]...)\n\t}\n\topts.binary = bin\n\n\tsuspended, errChan, stChan := run(a, opts)\n\tif !suspended {\n\t\treturn fmt.Errorf(\"unable to run command\")\n\t}\n\tfor v := range stChan {\n\t\tslog.Debug(\"stdout\", slogs.Line, v)\n\t}\n\tvar errs error\n\tfor e := range errChan {\n\t\terrs = errors.Join(errs, e)\n\t}\n\n\treturn errs\n}\n\nfunc run(a *App, opts *shellOpts) (ok bool, errC chan error, outC chan string) {\n\terrChan := make(chan error, 1)\n\tstatusChan := make(chan string, 1)\n\n\tif opts.background {\n\t\tif err := execute(opts, statusChan); err != nil {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/derailed/k9s/blob/2d3ccc6ba2ce98c3781bfc441bb3e884f072774f/internal/view/exec.go#L69-L105","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["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)"],"tags":["k9s","exec","tui","race-condition","terminal"],"backgroundTag":null,"analyzedSha":"2d3ccc6ba2ce98c3781bfc441bb3e884f072774f","analyzedAt":"2026-08-15T16:09:14.432Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}