abiosoft/colima · error

error running %v, output: %s, err: %s

Error message

error running %v, output: %s, err: %s

What it means

This is errCmd, the universal wrapper for any failed host command executed via hostEnv.Run/RunOutput: it formats the argv slice, the first line of captured stderr, and the underlying exec error. It is the single most common error surface in colima — every failed limactl/kubectl/docker/cp invocation on the host funnels through here, so the wrapped cause (err) and first stderr line are the real diagnostic payload.

Source

Thrown at environment/host/host.go:129

	cmd.Stdout = &buf
	cmd.Stderr = &errBuf

	err := cmd.Run()
	if err != nil {
		return "", errCmd(cmd.Args, errBuf, err)
	}

	return strings.TrimSpace(buf.String()), nil
}

func errCmd(args []string, stderr bytes.Buffer, err error) error {
	// this is going to be part of a log output,
	// reading the first line of the error should suffice
	output, _ := stderr.ReadString('\n')
	if len(output) > 0 {
		output = output[:len(output)-1]
	}
	return fmt.Errorf("error running %v, output: %s, err: %s", args, strconv.Quote(output), strconv.Quote(err.Error()))
}

func (h hostEnv) RunInteractive(args ...string) error {
	if len(args) == 0 {
		return errors.New("args not specified")
	}
	cmd := cli.CommandInteractive(args[0], args[1:]...)
	cmd.Env = append(os.Environ(), h.env...)
	if h.dir != "" {
		cmd.Dir = h.dir
	}
	return cmd.Run()
}

func (h hostEnv) RunWith(stdin io.Reader, stdout io.Writer, args ...string) error {
	if len(args) == 0 {
		return errors.New("args not specified")
	}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Read the message fully — 'output:' carries the command's first stderr line (e.g. limactl's actual complaint) and 'err:' the Go exec status; fix that root cause first.
  2. Re-verify host dependencies: 'colima version', 'limactl --version', 'kubectl version --client' and reinstall missing pieces (brew install/reinstall lima kubectl).
  3. If the failing command is limactl, inspect instance state: 'limactl list' and ~/.lima/<profile>/*.log for the underlying VM error; a wedged VM usually needs 'colima delete -f'.
  4. Run the exact argv shown in the error manually in the same shell to reproduce interactively, e.g. copy the 'error running [...]' list verbatim.
  5. Ensure PATH is sane in the launching context (GUI launchers, cron, CI inherit a minimal PATH — prefix /opt/homebrew/bin or /usr/local/bin).
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight the binary before invoking it via Run
func runChecked(h environment.Host, args ...string) error {
    if _, err := exec.LookPath(args[0]); err != nil {
        return fmt.Errorf("%s not found in PATH", args[0])
    }
    return h.Run(args...)
}

Try / catch

out, err := c.host.RunOutput("kubectl", "config", "use-context", profile)
if err != nil {
    // errCmd embeds first stderr line; branch on known causes
    if strings.Contains(err.Error(), exec.ErrNotFound.Error()) {
        return fmt.Errorf("kubectl missing from PATH: %w", err)
    }
    return fmt.Errorf("error updating kubeconfig: %w", err)
}

Prevention

When it happens

Trigger: Any (h.host).Run/RunOutput/RunInteractive on the host exiting non-zero: 'limactl start' failing (VM boot errors), 'cp' failing in kubeconfig steps, 'kubectl config use-context' failing when kubectl is missing or the context is absent, brew-installed binaries removed mid-run, exec.ErrNotFound (binary not in PATH) surfaces here as err.

Common situations: brew upgrade removed/relinked lima or kubectl between colima runs; xcode CLT/license dialogs making helper binaries fail; PATH differences when colima runs from GUI launchers vs terminal; VM in a bad state making limactl error out; disk full making every write command fail.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/84d55f0c32ebd99a. Report an issue: GitHub.