spicetify/cli · error

invalid version string

Error message

invalid version string

What it means

This helper parses a version string into [major, minor, patch] ints. After stripping an optional leading "v", it splits on "." and requires exactly 3 components; anything else returns "invalid version string" from src/preprocess/preprocess.go, and non-numeric components surface Atoi errors similarly.

Source

Thrown at src/preprocess/preprocess.go:1106

	if buildType != "Release" {
		return fmt.Errorf("detected %s Spotify build! spicetify works only on Release builds. Please install latest Release version of Spotify", buildType)
	}

	utils.PrintSuccess(fmt.Sprintf("Spotify's build type is %s. Continuing...", string(matches[1])))
	return nil
}

type githubRelease = utils.GithubRelease

func splitVersion(version string) ([3]int, error) {
	vstring := version
	if vstring[0:1] == "v" {
		vstring = version[1:]
	}
	vSplit := strings.Split(vstring, ".")
	var vInts [3]int
	if len(vSplit) != 3 {
		return [3]int{}, errors.New("invalid version string")
	}
	for i := range 3 {
		conv, err := strconv.Atoi(vSplit[i])
		if err != nil {
			return [3]int{}, err
		}
		vInts[i] = conv
	}
	return vInts, nil
}

func FetchLatestTagMatchingOrMain(version string) (string, error) {
	tag, err := utils.FetchLatestTag()
	if err != nil {
		return "", err
	}
	ver, err := splitVersion(tag)
	if err != nil {

View on GitHub (pinned to 1f13f73616)

Solutions

  1. Ensure the version string is exactly three dot-separated integers, e.g. "1.2.34"
  2. Check where the version is sourced (Spotify binary metadata) for corruption
  3. Pin/upgrade spicetify so its expected Spotify version format matches your build
  4. Sanitize the input (strip prefixes/suffixes) before parsing

Example fix

// before
parseVersion("1.2")            // error
// after
parseVersion("1.2.0")
Defensive patterns

Strategy: validation

Validate before calling

func isSemverTriple(s string) bool {
    s = strings.TrimPrefix(s, "v")
    parts := strings.Split(s, ".")
    if len(parts) != 3 { return false }
    for _, p := range parts {
        if _, err := strconv.Atoi(p); err != nil { return false }
    }
    return true
}
// only call parseVersion when isSemverTriple(version) is true

Try / catch

v, err := parseVersion(raw)
if err != nil {
    if errors.Is(err, errInvalidVersionString) || err.Error() == "invalid version string" {
        // skip patching or request a supported Spotify version
        return nil
    }
    return err
}

Prevention

When it happens

Trigger: Passing a version like "1.2" (only two components), "1.2.3.4" (four), an empty string, or strings like "1.2.x" where the segments aren't purely numeric into the version-parsing function used during preprocessing.

Common situations: Spotify reporting an unusual/nonstandard version format after an update; feed/version metadata missing a segment; custom or dev builds exposing versions like "1.2.3-debug.1"; leading "v" handling mismatch.


AI-assisted analysis of spicetify/cli@1f13f73616 (2026-08-31). Data as JSON: /api/errors/120a5cbf32a4cf39. Report an issue: GitHub.