{"record":{"id":"b81d39dd8bafe0a2","repo":"abiosoft/colima","slug":"error-in-config-file-w","errorCode":null,"errorMessage":"error in config file: %w","messagePattern":"error in config file: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/start.go","lineNumber":73,"sourceCode":"\t\tconf := startCmdArgs.Config\n\n\t\tif !startCmdArgs.Flags.Edit {\n\t\t\tif app.Active() {\n\t\t\t\tlog.Warnln(\"already running, ignoring\")\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn start(app, conf)\n\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 {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/cmd/start.go#L55-L91","documentation":"`colima start --edit` opens the profile's YAML in $EDITOR, then feeds the saved config through configmanager.ValidateConfig before using it. This error wraps validation failure: unknown/renamed keys, wrong value types (e.g. cpu as a string), out-of-range numbers, or structurally invalid YAML. The wrapped message names the offending field, and the VM is NOT started — the edit is rejected wholesale.","triggerScenarios":"Saving the editor buffer with a typo or indentation error; carrying config keys from an older colima version after an upgrade; quoting numeric fields; emptying the file or saving it in the wrong format.","commonSituations":"Major colima upgrades renaming or moving settings; hand-crafting the YAML from blog posts; editors inserting tabs or stripping content; copy-pasting configs between profiles with divergent schemas.","solutions":["Read the wrapped message — it identifies the exact field; fix that key and re-run `colima start --edit`","Regenerate a known-good baseline: revert to defaults in the editor and change one field at a time","Skip the editor for simple changes: use `colima start --cpu 4 --memory 8` style flags; if hand-editing, check YAML syntax with yamllint first"],"exampleFix":"# before (edited config)\ncpu: \"4\"        # error in config file: cpu: cannot unmarshal string into Go int\nmemory: 6\n\n# after\ncpu: 4\nmemory: 6","handlingStrategy":"validation","validationCode":"// validate before trusting an edited config (Go, mirrors the CLI's own check)\nif err := configmanager.ValidateConfig(conf); err != nil {\n    fmt.Fprintf(os.Stderr, \"config invalid: %v\\n\", err)\n    os.Exit(1) // do NOT proceed to start\n}\n\n# shell: syntax-check the file before the start --edit round-trip\nyamllint ~/.colima/_config/<profile>.yaml","typeGuard":null,"tryCatchPattern":"if err := startCmd.Execute(); err != nil {\n    if strings.Contains(err.Error(), \"error in config file\") {\n        // the wrapped error names the bad field; fix the $EDITOR buffer and re-run,\n        // or abandon the edit and start with flags: colima start --cpu 4 --memory 8\n    }\n}","preventionTips":["After every colima upgrade, re-diff your config against freshly generated defaults — keys get renamed","Change one field per edit and re-run so validation errors point at a single cause","Prefer CLI flags or presets over hand-edited YAML for simple tweaks","Run yamllint (or the editor's YAML LSP) before saving the edit buffer"],"tags":["colima","config","yaml","validation","startup"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}