abiosoft/colima · error

error parsing incus config template: %w

Error message

error parsing incus config template: %w

What it means

Colima renders the embedded config.yaml preseed for 'incus admin init --preseed' with util.ParseTemplate (Go text/template), and template execution failed. Because both template and value struct ship with colima, this is almost always a build/version mismatch or a malformed embedded asset, not a runtime condition.

Source

Thrown at environment/container/incus/incus.go:110

		// previous disk exists
		// ignore storage, recovery would be attempted later
		recoverStorage = cli.Prompt("existing Incus data found, would you like to recover the storage pool(s)")
	}

	var value struct {
		Disk          int
		Interface     string
		BridgeGateway string
		SetStorage    bool
	}
	value.Disk = conf.Disk
	value.Interface = incusBridgeInterface
	value.BridgeGateway = bridgeGateway
	value.SetStorage = emptyDisk // set only when the disk is empty

	buf, err := util.ParseTemplate(configYaml, value)
	if err != nil {
		return fmt.Errorf("error parsing incus config template: %w", err)
	}

	stdin := bytes.NewReader(buf)
	if err := c.guest.RunWith(stdin, nil, "sudo", "incus", "admin", "init", "--preseed"); err != nil {
		return fmt.Errorf("error setting up incus: %w", err)
	}

	// provision successful
	if emptyDisk {
		return nil
	}

	if !recoverStorage {
		return c.wipeDisk(conf.Disk)
	}

	if _, err := c.guest.Stat(poolDiskFile); err != nil {
		log.Warnln(fmt.Errorf("cannot recover disk: %w, creating new storage pool", err))

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Reinstall/upgrade colima to a released version matching its embedded assets
  2. If building from source, do a clean rebuild: 'go clean -cache && go build ./...'
  3. Run 'colima version' and report the mismatch if it persists — this is an internal bug, not a config error
Defensive patterns

Strategy: validation

Validate before calling

// fail fast if embedded template and struct disagree (build sanity check)
if _, err := util.ParseTemplate(configYaml, struct {
    Disk int; Interface, BridgeGateway string; SetStorage bool
}{}); err != nil {
    return fmt.Errorf("embedded preseed template broken, rebuild colima: %w", err)
}

Try / catch

buf, err := util.ParseTemplate(configYaml, value)
if err != nil {
    return fmt.Errorf("error parsing incus config template: %w", err)
    // not retryable: template and binary ship together; reinstall a matching release
}

Prevention

When it happens

Trigger: ParseTemplate(configYaml, value) returns an error: a template field is missing from the anonymous value struct (Disk, Interface, BridgeGateway, SetStorage), the embedded config.yaml is corrupt, or a mixed-version binary/embedded files.

Common situations: Building colima from a partial/dirty checkout where embedded files were not updated, or a version skew between the binary and embedded config.yaml after an interrupted upgrade.

Related errors


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