abiosoft/colima · error

error decoding 'limactl info' json: %w

Error message

error decoding 'limactl info' json: %w

What it means

After 'limactl info' succeeds, LimaVersionSupported decodes the captured stdout as JSON into a struct with a version field. If stdout is not valid JSON, json.Decoder.Decode fails and is wrapped as 'error decoding limactl info json'. This means limactl ran but emitted something other than the expected JSON document.

Source

Thrown at core/core.go:59

	return install()
}

// LimaVersionSupported checks if the currently installed Lima version is supported.
func LimaVersionSupported() error {
	var values struct {
		Version string `json:"version"`
	}
	var buf bytes.Buffer
	cmd := cli.Command("limactl", "info")
	cmd.Stdout = &buf

	if err := cmd.Run(); err != nil {
		return fmt.Errorf("error checking Lima version: %w", err)
	}

	if err := json.NewDecoder(&buf).Decode(&values); err != nil {
		return fmt.Errorf("error decoding 'limactl info' json: %w", err)
	}
	// remove pre-release hyphen
	parts := strings.SplitN(values.Version, "-", 2)
	if len(parts) > 0 {
		values.Version = parts[0]
	}

	if parts[0] == "HEAD" {
		logrus.Warnf("to avoid compatibility issues, ensure lima development version (%s) in use is not lower than %s", values.Version, limaVersion)
		return nil
	}

	min := semver.New(strings.TrimPrefix(limaVersion, "v"))
	current, err := semver.NewVersion(strings.TrimPrefix(values.Version, "v"))
	if err != nil {
		return fmt.Errorf("invalid semver version for Lima: %w", err)
	}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Run 'limactl info' manually and confirm it prints pure JSON containing a version key
  2. Upgrade Lima to at least v0.18.0, the minimum colima supports: brew upgrade lima
  3. Remove any shim or wrapper around limactl from PATH
  4. If warnings precede the JSON, resolve the underlying Lima warning so stdout stays clean

Example fix

# before (distro limactl prints usage text)
colima start   # error decoding 'limactl info' json

# after
brew uninstall lima && brew install lima && colima start
Defensive patterns

Strategy: validation

Validate before calling

out, err := exec.Command("limactl", "info").Output()
if err != nil { /* covered by error 97 */ }
if !json.Valid(bytes.TrimSpace(out)) {
    // limactl is not emitting JSON: upgrade to upstream lima >= v0.18.0
}

Try / catch

if err := core.LimaVersionSupported(); err != nil {
    if strings.Contains(err.Error(), "error decoding") {
        // stdout was not JSON: inspect 'limactl info' output and remove shims
    }
}

Prevention

When it happens

Trigger: A Lima build whose 'limactl info' prints help/usage text instead of JSON (very old or distro-patched limactl without the info subcommand), warnings injected into stdout, or a shim/wrapper earlier in PATH rewriting limactl output.

Common situations: Linux distro packages of Lima differing from upstream; version managers or wrappers shimming limactl; untested Lima forks; shell PATH hooks appending text to command output.

Related errors


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