{"record":{"id":"120a5cbf32a4cf39","repo":"spicetify/cli","slug":"invalid-version-string","errorCode":null,"errorMessage":"invalid version string","messagePattern":"invalid version string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/preprocess/preprocess.go","lineNumber":1106,"sourceCode":"\tif buildType != \"Release\" {\n\t\treturn fmt.Errorf(\"detected %s Spotify build! spicetify works only on Release builds. Please install latest Release version of Spotify\", buildType)\n\t}\n\n\tutils.PrintSuccess(fmt.Sprintf(\"Spotify's build type is %s. Continuing...\", string(matches[1])))\n\treturn nil\n}\n\ntype githubRelease = utils.GithubRelease\n\nfunc splitVersion(version string) ([3]int, error) {\n\tvstring := version\n\tif vstring[0:1] == \"v\" {\n\t\tvstring = version[1:]\n\t}\n\tvSplit := strings.Split(vstring, \".\")\n\tvar vInts [3]int\n\tif len(vSplit) != 3 {\n\t\treturn [3]int{}, errors.New(\"invalid version string\")\n\t}\n\tfor i := range 3 {\n\t\tconv, err := strconv.Atoi(vSplit[i])\n\t\tif err != nil {\n\t\t\treturn [3]int{}, err\n\t\t}\n\t\tvInts[i] = conv\n\t}\n\treturn vInts, nil\n}\n\nfunc FetchLatestTagMatchingOrMain(version string) (string, error) {\n\ttag, err := utils.FetchLatestTag()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tver, err := splitVersion(tag)\n\tif err != nil {","sourceCodeStart":1088,"sourceCodeEnd":1124,"githubUrl":"https://github.com/spicetify/cli/blob/1f13f736163165234eef4fb792a03f9b5b732aa4/src/preprocess/preprocess.go#L1088-L1124","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the version string is exactly three dot-separated integers, e.g. \"1.2.34\"","Check where the version is sourced (Spotify binary metadata) for corruption","Pin/upgrade spicetify so its expected Spotify version format matches your build","Sanitize the input (strip prefixes/suffixes) before parsing"],"exampleFix":"// before\nparseVersion(\"1.2\")            // error\n// after\nparseVersion(\"1.2.0\")","handlingStrategy":"validation","validationCode":"func isSemverTriple(s string) bool {\n    s = strings.TrimPrefix(s, \"v\")\n    parts := strings.Split(s, \".\")\n    if len(parts) != 3 { return false }\n    for _, p := range parts {\n        if _, err := strconv.Atoi(p); err != nil { return false }\n    }\n    return true\n}\n// only call parseVersion when isSemverTriple(version) is true","typeGuard":null,"tryCatchPattern":"v, err := parseVersion(raw)\nif err != nil {\n    if errors.Is(err, errInvalidVersionString) || err.Error() == \"invalid version string\" {\n        // skip patching or request a supported Spotify version\n        return nil\n    }\n    return err\n}","preventionTips":["Validate version strings match ^v?\\d+\\.\\d+\\.\\d+$ before parsing","Strip non-numeric suffixes (e.g. \"-debug.1\") upstream","Log the raw version string when parsing fails to catch format drift"],"tags":["version-parsing","format-validation"],"backgroundTag":"invalid-version-format","analyzedSha":"1f13f736163165234eef4fb792a03f9b5b732aa4","analyzedAt":"2026-08-31T18:57:59.754Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}