spicetify/cli · error

could not read %s: %w

Error message

could not read %s: %w

What it means

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.

Source

Thrown at src/preprocess/preprocess.go:1076

				// Class is a self-invoking function
				URI = fmt.Sprintf("%s()", URI)
			}

			input = strings.Replace(
				input,
				URI,
				fmt.Sprintf("%s;Spicetify.URI=%s;", URI, URIObj[1]),
				1)
		}
	}

	return applyPatches(input, vendorPatches)
}

func validateReleaseBuild(spotifyBinaryPath string) error {
	fileContent, err := os.ReadFile(spotifyBinaryPath)
	if err != nil {
		return fmt.Errorf("could not read %s: %w", filepath.Base(spotifyBinaryPath), err)
	}

	buildRegex := regexp.MustCompile(`(Master|Release|PR|Local) Build.+(?:cef_)?(\d+\.\d+\.\d+\+g[0-9a-f]+\+chromium-\d+\.\d+\.\d+\.\d+)`)
	matches := buildRegex.FindSubmatch(fileContent)

	if len(matches) == 0 {
		utils.PrintWarning(fmt.Sprintf("Could not detect Spotify build type in %s, skipping validation", filepath.Base(spotifyBinaryPath)))
		return nil
	}

	buildType := string(matches[1])
	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
}

View on GitHub (pinned to 1f13f73616)

Solutions

  1. Verify the configured spotify_path in spicetify config points at the real Spotify executable.
  2. Check file permissions on the Spotify binary (readable by the current user).
  3. Reinstall Spotify if the binary is missing, then run `spicetify backup apply` again.
  4. On Linux, avoid Snap/Flatpak Spotify installs; use the deb/native package so the binary path is directly readable.
Defensive patterns

Strategy: validation

Validate before calling

if info, err := os.Stat(spotifyBinaryPath); err != nil || info.IsDir() {
    return fmt.Errorf("spotify binary not readable at %s", spotifyBinaryPath)
}

Try / catch

if err := preprocess(); err != nil {
    var pathErr *fs.PathError
    if errors.As(err, &pathErr) {
        // fix spotify_path in config or reinstall Spotify
    }
    return err
}

Prevention

When it happens

Trigger: validateReleaseBuild(spotifyBinaryPath) called with a path that os.ReadFile cannot open: file missing, no read permission, or path is a directory.

Common situations: 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.

Related errors


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