{"record":{"id":"4e635174b56b6129","repo":"spicetify/cli","slug":"could-not-read-s-w","errorCode":null,"errorMessage":"could not read %s: %w","messagePattern":"could not read (.+?): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/preprocess/preprocess.go","lineNumber":1076,"sourceCode":"\t\t\t\t// Class is a self-invoking function\n\t\t\t\tURI = fmt.Sprintf(\"%s()\", URI)\n\t\t\t}\n\n\t\t\tinput = strings.Replace(\n\t\t\t\tinput,\n\t\t\t\tURI,\n\t\t\t\tfmt.Sprintf(\"%s;Spicetify.URI=%s;\", URI, URIObj[1]),\n\t\t\t\t1)\n\t\t}\n\t}\n\n\treturn applyPatches(input, vendorPatches)\n}\n\nfunc validateReleaseBuild(spotifyBinaryPath string) error {\n\tfileContent, err := os.ReadFile(spotifyBinaryPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not read %s: %w\", filepath.Base(spotifyBinaryPath), err)\n\t}\n\n\tbuildRegex := regexp.MustCompile(`(Master|Release|PR|Local) Build.+(?:cef_)?(\\d+\\.\\d+\\.\\d+\\+g[0-9a-f]+\\+chromium-\\d+\\.\\d+\\.\\d+\\.\\d+)`)\n\tmatches := buildRegex.FindSubmatch(fileContent)\n\n\tif len(matches) == 0 {\n\t\tutils.PrintWarning(fmt.Sprintf(\"Could not detect Spotify build type in %s, skipping validation\", filepath.Base(spotifyBinaryPath)))\n\t\treturn nil\n\t}\n\n\tbuildType := string(matches[1])\n\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}","sourceCodeStart":1058,"sourceCodeEnd":1094,"githubUrl":"https://github.com/spicetify/cli/blob/1f13f736163165234eef4fb792a03f9b5b732aa4/src/preprocess/preprocess.go#L1058-L1094","documentation":"validateReleaseBuild reads the Spotify binary and, before checking the build type, must read the file from disk. If os.ReadFile fails (permission denied, missing file, path points to a directory), the error is wrapped as \"could not read <basename>: <cause>\". It is a precondition failure of the build validation step in preprocessing.","triggerScenarios":"validateReleaseBuild(spotifyBinaryPath) called with a path that os.ReadFile cannot open: file missing, no read permission, or path is a directory.","commonSituations":"Spotify installed via Snap/Flatpak where the binary path is a sandbox mount; wrong spotify_path in config.ini; Spotify uninstalled/upgraded and binary removed; running without permission to the install directory.","solutions":["Verify the configured spotify_path in spicetify config points at the real Spotify executable.","Check file permissions on the Spotify binary (readable by the current user).","Reinstall Spotify if the binary is missing, then run `spicetify backup apply` again.","On Linux, avoid Snap/Flatpak Spotify installs; use the deb/native package so the binary path is directly readable."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if info, err := os.Stat(spotifyBinaryPath); err != nil || info.IsDir() {\n    return fmt.Errorf(\"spotify binary not readable at %s\", spotifyBinaryPath)\n}","typeGuard":null,"tryCatchPattern":"if err := preprocess(); err != nil {\n    var pathErr *fs.PathError\n    if errors.As(err, &pathErr) {\n        // fix spotify_path in config or reinstall Spotify\n    }\n    return err\n}","preventionTips":["Validate spotify_path in config.ini after every Spotify reinstall/update.","Avoid Snap/Flatpak Spotify where the binary is not directly readable.","Check read permissions on the Spotify install directory before preprocessing."],"tags":["filesystem","spotify","preprocess"],"backgroundTag":"file-read-failed","analyzedSha":"1f13f736163165234eef4fb792a03f9b5b732aa4","analyzedAt":"2026-08-31T18:57:59.754Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}