tonhowtf/omniget · warning

[spotify-sdk] playback error:

Error message

[spotify-sdk] playback error:

What it means

The Spotify Web Playback SDK player emitted a 'playback_error' event, logged here with the SDK's message string. This means the SDK connected but a playback attempt on the device failed (e.g. track unplayable, licensing restrictions, device state issue). It is a per-playback failure, not an initialization failure.

Solutions

  1. Read the logged `message` from the SDK for the specific playback failure reason.
  2. Verify the account is Premium — Web Playback SDK requires Premium.
  3. Retry the play request / re-transfer playback to this device; stale device state often resolves after a fresh transfer.
  4. Check EME/DRM support (encrypted media) in the browser if messages indicate decoding failure.

Example fix

// before
player.addListener("playback_error", ({ message }) => { console.warn("[spotify-sdk] playback error:", message); });
// after
player.addListener("playback_error", ({ message }) => {
  console.warn("[spotify-sdk] playback error:", message);
  this.emitError({ kind: "playback", message }); // surface to UI so users can retry/re-transfer
});
Defensive patterns

Strategy: retry

Validate before calling

// before playing, confirm the SDK session is ready and premium-authorized
if (!this.ready || this.unavailableReason) return; // don't attempt playback on a non-premium/unready device

Type guard

function isPlaybackErrorPayload(v: unknown): v is { message: string } {
  return typeof v === "object" && v !== null && typeof (v as any).message === "string";
}

Try / catch

player.addListener("playback_error", ({ message }) => {
  console.warn("[spotify-sdk] playback error:", message);
  this.retryCurrentPlaybackOnce().catch(() => this.emitError({ kind: "playback", message }));
});

Prevention

When it happens

Trigger: The Spotify SDK player fires playback_error while a track transfer/play request targets this device — commonly when the requested content cannot be played on this device or session.

Common situations: Attempting to play region-locked or removed tracks; Spotify account without Premium (separate init_error path sets unavailableReason about Premium) but with a stale device state; device already claimed by another session; DRM/EME issues in the browser.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/14ea5a45b734f71b. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/study-music/spotify-sdk.svelte.ts:186

              reject(new Error(message));
            },
          );
          player.addListener(
            "authentication_error",
            ({ message }: { message: string }) => {
              this.unavailableReason = `auth: ${message}`;
            },
          );
          player.addListener(
            "account_error",
            ({ message }: { message: string }) => {
              this.unavailableReason = `Spotify Premium é obrigatório (${message})`;
            },
          );
          player.addListener(
            "playback_error",
            ({ message }: { message: string }) => {
              console.warn("[spotify-sdk] playback error:", message);
            },
          );
          player.addListener(
            "player_state_changed",
            (state: SpotifySdkState | null) => {
              this.emitState(state);
            },
          );

          this.player = player;
          void player.connect().catch((e) => {
            this.unavailableReason = `connect: ${String(e)}`;
            this.loading = false;
            reject(e);
          });
        };

        if (window.Spotify) {

View on GitHub (pinned to 8600b91f42)