abiosoft/colima · error

error reading template file: %w

Error message

error reading template file: %w

What it means

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.

Source

Thrown at cmd/template.go:41

	RunE: func(cmd *cobra.Command, args []string) error {
		if templateCmdArgs.Print {
			fmt.Println(templateFile())
			return nil
		}
		// there are unwarranted []byte to string overheads.
		// not a big deal in this case

		abort, err := embedded.ReadString("defaults/abort.yaml")
		if err != nil {
			return fmt.Errorf("error reading embedded file: %w", err)
		}
		info, err := embedded.ReadString("defaults/template.yaml")
		if err != nil {
			return fmt.Errorf("error reading embedded file: %w", err)
		}
		template, err := templateFileOrDefault()
		if err != nil {
			return fmt.Errorf("error reading template file: %w", err)
		}

		tmpFile, err := waitForUserEdit(templateCmdArgs.Editor, []byte(abort+"\n"+info+"\n"+template))
		if err != nil {
			return fmt.Errorf("error editing template file: %w", err)
		}
		if tmpFile == "" {
			return fmt.Errorf("empty file, template edit aborted")
		}
		defer func() {
			_ = os.Remove(tmpFile)
		}()

		// load and resave template to ensure the format is correct
		cf, err := configmanager.LoadFrom(tmpFile)
		if err != nil {
			return fmt.Errorf("error in template: %w", err)
		}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Reinstall colima from an official channel
  2. Rebuild from a clean source tree ensuring embedded/defaults/colima.yaml is present
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: 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.

Common situations: Nonstandard builds where the embedded default YAML was stripped; virtually absent in official binaries.

Related errors


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