abiosoft/colima · error

error in config: %w

Error message

error in config: %w

What it means

PreRunE of `colima start` rejects the merged configuration (CLI flags merged over the config file via prepareConfig) through configmanager.ValidateConfig. The wrapped error names the exact violation: invalid mountType (only 9p/sshfs, plus virtiofs on macOS 13+), invalid vmType (qemu; vz on macOS 13+; krunkit only on Apple Silicon macOS 13+), missing qemu-img/krunkit binary, remote diskImage URL, invalid port forwarder (grpc/ssh/none), gateway not IPv4 ending in .2, or a mount path containing spaces.

Source

Thrown at cmd/start.go:100

			}
			// pause before startup to prevent race condition
			time.Sleep(time.Second * 3)
		}

		return start(app, conf)
	},
	PreRunE: func(cmd *cobra.Command, args []string) error {
		// validate Lima version
		if err := core.LimaVersionSupported(); err != nil {
			return fmt.Errorf("lima compatibility error: %w", err)
		}

		// combine args and current config file(if any)
		prepareConfig(cmd)

		// validate config
		if err := configmanager.ValidateConfig(startCmdArgs.Config); err != nil {
			return fmt.Errorf("error in config: %w", err)
		}

		// persist in preparation for application start
		if startCmdArgs.Flags.SaveConfig {
			if err := configmanager.Save(startCmdArgs.Config); err != nil {
				return fmt.Errorf("error preparing config file: %w", err)
			}
		}

		// validate and set downloader if flag is specified (takes precedence over env var)
		if cmd.Flag("downloader").Changed {
			normalized, err := downloader.ValidateDownloader(startCmdArgs.Flags.Downloader)
			if err != nil {
				return err
			}
			downloader.SetDownloader(normalized)
		}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Read the wrapped message — it names the exact field and allowed values; fix the flag or the config file entry it points to
  2. Check platform constraints: `sw_vers` for macOS version; virtiofs/vz need macOS 13+, krunkit needs Apple Silicon
  3. Install missing tools for the chosen vmType: qemu-img for qemu (brew install qemu), krunkit for krunkit
  4. Edit or reset the persisted config: `colima start --edit`, or `colima delete` to discard it entirely

Example fix

# before
$ colima start --mount-type virtiofs   # on macOS 12
Error: error in config: invalid mountType: 'virtiofs'

# after
$ colima start --mount-type 9p        # or upgrade to macOS 13+ for virtiofs
Defensive patterns

Strategy: validation

Validate before calling

// Validate enums the same way ValidateConfig does before invoking colima start
validMount := map[string]bool{"9p": true, "sshfs": true}
validVM := map[string]bool{"qemu": true}
// add "virtiofs"/"vz" only on macOS 13+, "krunkit" only on macOS 13+ Apple Silicon
if !validMount[mountType] || !validVM[vmType] {
    log.Fatal("invalid mountType or vmType for this platform")
}
for _, m := range mounts {
    if strings.Contains(m, " ") {
        log.Fatalf("mount path %q contains spaces (unsupported)", m)
    }
}

Prevention

When it happens

Trigger: `colima start --mount-type virtiofs` on macOS < 13; `--vm-type vz` on an old macOS; `--vm-type qemu` without qemu-img installed; `--diskImage https://...`; `--port-forwarder docker`; `--network-gateway` with a non-.2 last octet; a mount location containing a space.

Common situations: Copy-pasted flags from docs/newer issues onto an older macOS; config file edited by hand with a typo'd enum; spaces in mount paths ( silently failing at Lima level, now validated); upgrading macOS but keeping an invalid stale config.

Related errors


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