abiosoft/colima · error

error stopping :%w

Error message

error stopping :%w

What it means

Thrown by the `colima start` RunE when Colima is already running, the user accepts the 'restart to apply changes' prompt, and app.Stop(false) fails to halt the existing VM. app.Stop wraps the Lima `limactl stop` flow (and daemon teardown), so the error usually carries an underlying limactl failure or timeout. Colima aborts the new start because applying config changes requires a clean stop first.

Source

Thrown at cmd/start.go:81

		}

		// edit flag is specified
		conf, err := editConfigFile()
		if err != nil {
			return err
		}

		// validate config
		if err := configmanager.ValidateConfig(conf); err != nil {
			return fmt.Errorf("error in config file: %w", err)
		}

		if app.Active() {
			if !cli.Prompt("colima is currently running, restart to apply changes") {
				return nil
			}
			if err := app.Stop(false); err != nil {
				return fmt.Errorf("error stopping :%w", err)
			}
			// pause before startup to prevent race condition
			time.Sleep(time.Second * 3)
		}

		return start(app, conf)
	},
	PreRunE: func(cmd *cobra.Command, args []string) error {
		// validate Lima version
		if err := core.LimaVersionSupported(); err != nil {
			return fmt.Errorf("lima compatibility error: %w", err)
		}

		// combine args and current config file(if any)
		prepareConfig(cmd)

		// validate config
		if err := configmanager.ValidateConfig(startCmdArgs.Config); err != nil {

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Run `colima stop` (or `colima stop --force` if available in your version) separately and inspect its fuller error output
  2. Check instance state with `limactl list` and `colima status`; retry `colima stop` if it was a transient timeout
  3. If stop keeps failing, `colima delete` and `colima start` fresh (destroys the VM and its data)
  4. Verify colima and lima versions are compatible after upgrades: `limactl info` and `brew upgrade lima colima`

Example fix

// before: start fails because stop of the running instance failed
colima start --cpus 4   # -> error stopping :...

# after: stop cleanly, then start with the new settings
colima stop
colima start --cpus 4
Defensive patterns

Strategy: retry

Validate before calling

// Before colima start: ensure no half-dead instance will fail the stop
state, err := exec.Command("colima", "status").CombinedOutput()
if err == nil {
    // instance active; stop it explicitly so a failure surfaces in `colima stop`,
    // which reports the underlying limactl error more directly
    if out, err := exec.Command("colima", "stop").CombinedOutput(); err != nil {
        log.Fatalf("pre-start stop failed: %v\n%s", err, out)
    }
}

Try / catch

err := startCmd.Execute()
if err != nil && strings.Contains(err.Error(), "error stopping") {
    // underlying cause is wrapped; unwrap with errors.As/Unwrap to inspect
    var exitErr *exec.ExitError
    if errors.As(err, &exitErr) {
        // limactl-level failure code available in exitErr.ExitCode()
    }
}

Prevention

When it happens

Trigger: Running `colima start` (or `colima start --edit` with modified settings) while `app.Active()` is true, answering yes to the restart prompt, and the Lima VM failing to stop: limactl stop returns non-zero, the VM is wedged/force-stop times out, or the Lima daemon state is inconsistent.

Common situations: Changing cpu/memory/disk on a running instance; a previous colima or limactl process crashed leaving stale state; Lima/colima version mismatch after a brew upgrade; heavy VM load preventing a graceful shutdown within the timeout.

Related errors


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