abiosoft/colima · error

invalid semver version for Lima: %w

Error message

invalid semver version for Lima: %w

What it means

LimaVersionSupported strips any pre-release suffix after the first hyphen, special-cases 'HEAD' builds with a warning, then parses Lima's reported version with semver.NewVersion. If the remaining string is not valid semantic versioning, the parse error is wrapped as 'invalid semver version for Lima'.

Source

Thrown at core/core.go:75

	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)
	}

	if min.Compare(*current) > 0 {
		return fmt.Errorf("minimum Lima version supported is %s, current version is %s", limaVersion, values.Version)
	}

	return nil
}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Switch to an official upstream Lima release: brew install lima (v0.18.0 or newer)
  2. Inspect the exact string with 'limactl info | jq -r .version' to see what colima cannot parse
  3. Remove distro forks or wrappers that alter the version output and retest

Example fix

# before (limactl reports version '0.20')
colima start   # invalid semver version for Lima

# after
brew reinstall lima   # reports e.g. '0.20.0', valid semver
colima start
Defensive patterns

Strategy: validation

Validate before calling

out, _ := exec.Command("limactl", "info").Output()
var v struct{ Version string `json:"version"` }
_ = json.Unmarshal(out, &v)
cleaned := strings.SplitN(v.Version, "-", 2)[0]
if _, err := semver.NewVersion(strings.TrimPrefix(cleaned, "v")); err != nil {
    // reported Lima version is not semver: switch to an official release
}

Try / catch

if err := core.LimaVersionSupported(); err != nil {
    if strings.Contains(err.Error(), "invalid semver") {
        // forked/distro Lima reports a non-semver version; install upstream lima
    }
}

Prevention

When it happens

Trigger: limactl info reporting a version that, after cutting at the first '-', is not valid semver: two-segment versions like '0.20', date-based schemes like '20240812', or words like 'master'/'stable' in the version field.

Common situations: Distro-packaged Lima (Debian, Fedora) with custom version schemes; bleeding-edge or forked Lima builds; wrappers that rewrite the reported version string.

Related errors


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