{"record":{"id":"95c170c60e74729b","repo":"abiosoft/colima","slug":"error-stopping-w","errorCode":null,"errorMessage":"error stopping :%w","messagePattern":"error stopping :%w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/start.go","lineNumber":81,"sourceCode":"\t\t}\n\n\t\t// edit flag is specified\n\t\tconf, err := editConfigFile()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// validate config\n\t\tif err := configmanager.ValidateConfig(conf); err != nil {\n\t\t\treturn fmt.Errorf(\"error in config file: %w\", err)\n\t\t}\n\n\t\tif app.Active() {\n\t\t\tif !cli.Prompt(\"colima is currently running, restart to apply changes\") {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tif err := app.Stop(false); err != nil {\n\t\t\t\treturn fmt.Errorf(\"error stopping :%w\", err)\n\t\t\t}\n\t\t\t// pause before startup to prevent race condition\n\t\t\ttime.Sleep(time.Second * 3)\n\t\t}\n\n\t\treturn start(app, conf)\n\t},\n\tPreRunE: func(cmd *cobra.Command, args []string) error {\n\t\t// validate Lima version\n\t\tif err := core.LimaVersionSupported(); err != nil {\n\t\t\treturn fmt.Errorf(\"lima compatibility error: %w\", err)\n\t\t}\n\n\t\t// combine args and current config file(if any)\n\t\tprepareConfig(cmd)\n\n\t\t// validate config\n\t\tif err := configmanager.ValidateConfig(startCmdArgs.Config); err != nil {","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/cmd/start.go#L63-L99","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `colima stop` (or `colima stop --force` if available in your version) separately and inspect its fuller error output","Check instance state with `limactl list` and `colima status`; retry `colima stop` if it was a transient timeout","If stop keeps failing, `colima delete` and `colima start` fresh (destroys the VM and its data)","Verify colima and lima versions are compatible after upgrades: `limactl info` and `brew upgrade lima colima`"],"exampleFix":"// before: start fails because stop of the running instance failed\ncolima start --cpus 4   # -> error stopping :...\n\n# after: stop cleanly, then start with the new settings\ncolima stop\ncolima start --cpus 4","handlingStrategy":"retry","validationCode":"// Before colima start: ensure no half-dead instance will fail the stop\nstate, err := exec.Command(\"colima\", \"status\").CombinedOutput()\nif err == nil {\n    // instance active; stop it explicitly so a failure surfaces in `colima stop`,\n    // which reports the underlying limactl error more directly\n    if out, err := exec.Command(\"colima\", \"stop\").CombinedOutput(); err != nil {\n        log.Fatalf(\"pre-start stop failed: %v\\n%s\", err, out)\n    }\n}","typeGuard":null,"tryCatchPattern":"err := startCmd.Execute()\nif err != nil && strings.Contains(err.Error(), \"error stopping\") {\n    // underlying cause is wrapped; unwrap with errors.As/Unwrap to inspect\n    var exitErr *exec.ExitError\n    if errors.As(err, &exitErr) {\n        // limactl-level failure code available in exitErr.ExitCode()\n    }\n}","preventionTips":["Stop instances explicitly with `colima stop` before scripted starts instead of relying on the interactive restart path","Keep colima and lima versions in lockstep (brew upgrades them together)","Avoid force-killing limactl/colima processes, which leaves state that breaks subsequent stops"],"tags":["lifecycle","lima","restart","vm"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}