{"record":{"id":"ef13c632598657a7","repo":"abiosoft/colima","slug":"error-reading-config-file-w","errorCode":null,"errorMessage":"error reading config file: %w","messagePattern":"error reading config file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/start.go","lineNumber":671,"sourceCode":"\t\t}\n\t\tif util.MacOSNestedVirtualizationSupported() {\n\t\t\tif !cmd.Flag(\"nested-virtualization\").Changed {\n\t\t\t\tstartCmdArgs.NestedVirtualization = current.NestedVirtualization\n\t\t\t}\n\t\t}\n\t}\n\n\tsetFixedConfigs(&startCmdArgs.Config)\n}\n\n// editConfigFile launches an editor to edit the config file.\nfunc editConfigFile() (config.Config, error) {\n\tvar c config.Config\n\n\t// preserve the current file in case the user terminates\n\tcurrentFile, err := os.ReadFile(config.CurrentProfile().File())\n\tif err != nil {\n\t\treturn c, fmt.Errorf(\"error reading config file: %w\", err)\n\t}\n\n\t// prepend the config file with termination instruction\n\tabort, err := embedded.ReadString(\"defaults/abort.yaml\")\n\tif err != nil {\n\t\tlog.Warnln(fmt.Errorf(\"unable to read embedded file: %w\", err))\n\t}\n\n\ttmpFile, err := waitForUserEdit(startCmdArgs.Flags.Editor, []byte(abort+\"\\n\"+string(currentFile)))\n\tif err != nil {\n\t\treturn c, fmt.Errorf(\"error editing config file: %w\", err)\n\t}\n\n\t// if file is empty, abort\n\tif tmpFile == \"\" {\n\t\treturn c, fmt.Errorf(\"empty file, startup aborted\")\n\t}\n","sourceCodeStart":653,"sourceCodeEnd":689,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/cmd/start.go#L653-L689","documentation":"Returned by editConfigFile, the `colima start --edit` path, when os.ReadFile on the current profile's config file fails. Since the config file is only created by a prior start, the dominant cause is 'no such file or directory' — there is no config to edit yet. Other causes are permission denial or the path being a directory.","triggerScenarios":"Running `colima start --edit` on a fresh install (never started, so config.CurrentProfile().File() does not exist); after `colima delete` removed the profile dir; config dir unreadable.","commonSituations":"New users following an 'edit your config' guide before the first start; scripting colima start --edit in CI on a clean machine; leftover root-owned ~/.colima after sudo use.","solutions":["Run a plain `colima start` once to generate the config file, then use `colima start --edit`","If the file exists but is unreadable, fix ownership: `sudo chown -R \"$USER\" ~/.colima`","Verify the expected path exists: `ls \"$(colima status 2>/dev/null || true)\"` or check under ~/.colima (or $COLIMA_HOME) for the profile's config","Alternatively create the minimal config manually from the embedded default: `colima template` shows the shape of the YAML"],"exampleFix":"# before\n$ colima start --edit\nError: error reading config file: open ~/.colima/_config/colima.yaml: no such file or directory\n\n# after\n$ colima start            # first start creates the config\n$ colima start --edit     # now editable","handlingStrategy":"validation","validationCode":"// Only offer the edit flow when a config already exists\nhome, _ := os.UserHomeDir()\nf := filepath.Join(home, \".colima\", \"_config\", \"colima.yaml\") // adjust for profile\nif _, err := os.Stat(f); errors.Is(err, fs.ErrNotExist) {\n    log.Println(\"no config yet; run `colima start` once before --edit\")\n    return\n}","typeGuard":null,"tryCatchPattern":"if _, err := editConfigFile(); err != nil {\n    var pathErr *fs.PathError\n    if errors.As(err, &pathErr) && errors.Is(pathErr.Err, fs.ErrNotExist) {\n        // first-run: bootstrap by starting once, then retry edit\n    }\n}","preventionTips":["Bootstrap with a plain `colima start` before scripting `--edit` flows","After `colima delete`, expect the config file to be gone; recreate via start"],"tags":["config","edit","file-not-found","first-run"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}