{"record":{"id":"035a3fe1f16d60ab","repo":"abiosoft/colima","slug":"error-reading-template-file-w","errorCode":null,"errorMessage":"error reading template file: %w","messagePattern":"error reading template file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/template.go","lineNumber":41,"sourceCode":"\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tif templateCmdArgs.Print {\n\t\t\tfmt.Println(templateFile())\n\t\t\treturn nil\n\t\t}\n\t\t// there are unwarranted []byte to string overheads.\n\t\t// not a big deal in this case\n\n\t\tabort, err := embedded.ReadString(\"defaults/abort.yaml\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading embedded file: %w\", err)\n\t\t}\n\t\tinfo, err := embedded.ReadString(\"defaults/template.yaml\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading embedded file: %w\", err)\n\t\t}\n\t\ttemplate, err := templateFileOrDefault()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading template file: %w\", err)\n\t\t}\n\n\t\ttmpFile, err := waitForUserEdit(templateCmdArgs.Editor, []byte(abort+\"\\n\"+info+\"\\n\"+template))\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error editing template file: %w\", err)\n\t\t}\n\t\tif tmpFile == \"\" {\n\t\t\treturn fmt.Errorf(\"empty file, template edit aborted\")\n\t\t}\n\t\tdefer func() {\n\t\t\t_ = os.Remove(tmpFile)\n\t\t}()\n\n\t\t// load and resave template to ensure the format is correct\n\t\tcf, err := configmanager.LoadFrom(tmpFile)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error in template: %w\", err)\n\t\t}","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/cmd/template.go#L23-L59","documentation":"Returned by `colima template` when templateFileOrDefault() errors. That helper stats/reads the on-disk template (TemplatesDir()/default.yaml); if the disk read fails it silently falls back to embedded.ReadString('defaults/colima.yaml') — so the surfaced error is the embedded default read failing. A missing on-disk template is normal (first use) and never errors.","triggerScenarios":"Running `colima template` when the user template file exists but the embedded defaults/colima.yaml is missing from the binary's embed FS (broken build); combined with a binary whose embedded root default was excluded. On-disk permission problems are masked by the fallback, not surfaced here.","commonSituations":"Nonstandard builds where the embedded default YAML was stripped; virtually absent in official binaries.","solutions":["Reinstall colima from an official channel","Rebuild from a clean source tree ensuring embedded/defaults/colima.yaml is present"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use official builds to guarantee the embedded default template ships in the binary","After moving embedded assets in a fork, run `go vet ./...` and a `colima template` smoke test"],"tags":["template","embedded-assets","build"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}