tonhowtf/omniget · error · Error
Spotify SDK device not ready
Error message
Spotify SDK device not ready
What it means
Raised by fetch_access_token when the playbackAccessToken object lacks a string 'value' field. The value is the opaque token payload embedded in authenticated clip URLs; without it the library cannot construct the download URL, so it returns an error after having already extracted the signature.
Solutions
- Log token_obj and verify the GQL query requests the value field inside playbackAccessToken.
- Update field names/pointers if Twitch renamed the field.
- Check the clip's accessibility (geo/auth restrictions can yield empty token payloads).
- Retry once — transient partial tokens do occur — then fail with the payload logged.
Example fix
// before
let value = token_obj
.get("value")
.and_then(|v| v.as_str())
.ok_or_else(|| anyhow!("Token sem value"))?
.to_string();
// after
let value = token_obj.get("value")
.and_then(|v| v.as_str())
.ok_or_else(|| anyhow!("Token sem value: {}", token_obj))? // log payload
.to_string(); Defensive patterns
Strategy: type-guard
Type guard
fn value_of(token_obj: &serde_json::Value) -> Option<&str> {
token_obj.get("value").and_then(|v| v.as_str()).filter(|v| !v.is_empty())
} Try / catch
// Require both parts of the token before building URLs
let (Some(sig), Some(val)) = (signature_of(&t), value_of(&t)) else {
anyhow::bail!("incomplete playback token: {}", t);
}; Prevention
- Validate the complete token object (signature + value) before use
- Log the token payload on failure to spot schema drift
- Keep the GQL query selectors for value/signature in sync with parsing code
- Restrict usage to clips confirmed publicly playable
When it happens
Trigger: token_obj.get("value").and_then(|v| v.as_str()) returns None — 'value' missing, null, or not a string inside the playbackAccessToken object.
Common situations: GQL schema change to the playbackAccessToken contract; partial/degraded token responses from Twitch for restricted clips; proxy or middleware stripping fields; incorrect manual GQL query omitting the value selector.
Related errors
- Track sem soundcloud_id
- SoundCloud nao retornou URL
- Access token not available for clip
- Token sem signature
- Token sem value
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/0ba4f008bf7d608e.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/study-music/spotify-sdk.svelte.ts:238
};
document.head.appendChild(script);
}
})();
}).catch((e) => {
this.loadingPromise = null;
throw e;
});
return this.loadingPromise;
}
async play(opts: {
uris?: string[];
contextUri?: string;
positionMs?: number;
}): Promise<void> {
await this.ensureLoaded();
if (!this.deviceId) throw new Error("Spotify SDK device not ready");
await pluginInvoke("study", "study:spotify:playback:play", {
deviceId: this.deviceId,
uris: opts.uris ?? [],
contextUri: opts.contextUri,
positionMs: opts.positionMs,
});
}
async pause(): Promise<void> {
if (this.player) await this.player.pause();
}
async resume(): Promise<void> {
if (this.player) await this.player.resume();
}
async togglePlay(): Promise<void> {
if (this.player) await this.player.togglePlay();View on GitHub (pinned to 8600b91f42)