tonhowtf/omniget · warning
[study-music] yt refresh failed
Error message
[study-music] yt refresh failed
What it means
Warning logged when the periodic YouTube stream-URL/chapters refresh for the current video fails. The store increments youtubeRefreshFailureCount and keeps retrying; once failures reach YOUTUBE_REFRESH_MAX_FAILURES it gives up (typically stopping playback).
Solutions
- Check network connectivity and retry playback
- Skip to a different track if the video was removed or is region-blocked
- Check backend YouTube extraction (e.g. ytdl/yt-dlp) is up to date — 403/429 responses indicate extractor staleness or rate limiting
- Restart playback to reset the failure counter and force a fresh resolve
Example fix
// before
} catch (err) {
this.youtubeRefreshFailureCount += 1;
// after
} catch (err) {
if (isRateLimitError(err)) await backoff(MusicPlayerStore.YOUTUBE_REFRESH_BACKOFF_MS);
this.youtubeRefreshFailureCount += 1; Defensive patterns
Strategy: retry
Validate before calling
if (!navigator.onLine) { scheduleYoutubeRefresh(videoId, Date.now() + 30_000); return; } Type guard
function isRefreshResult(v: unknown): v is { url: string; expires_at: number; chapters?: unknown[] } { return typeof v === "object" && v !== null && "url" in v && "expires_at" in v; } Try / catch
try { const res = await refreshStream(videoId); ... } catch (err) { if (attempt < MAX_FAILURES) { await backoff(attempt); return scheduleYoutubeRefresh(videoId, Date.now() + backoffMs(attempt)); } this.setError(classifyPlayerError(err, "youtube", videoId)); } Prevention
- Refresh the stream URL before expires_at, not after playback breaks
- Apply exponential backoff instead of fixed-interval retries
- Validate videos exist before adding them to playlists
- Keep the YouTube extractor/backend up to date to avoid 403/429s
When it happens
Trigger: The scheduled refresh's pluginInvoke/backend resolve of the YouTube video fails: expired video, network outage, rate limiting, or the video being removed/region-blocked.
Common situations: Long listening sessions where the stream URL expires and re-resolution hits rate limits; offline/VPN interruptions; deleted or age-restricted videos.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/b19c73e2d70791bd.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/study-music/player-store.svelte.ts:1659
console.info("[study-music] yt refresh start", { videoId });
const res = await studyYoutubePlayer({ videoId });
const url = pickBestYoutubeAudio(res);
const videoUrl = pickBestYoutubeVideo(res);
if (!url) throw new Error("refresh returned no audio format");
const wasPaused = this.audio.paused;
const t = this.audio.currentTime;
this.audio.crossOrigin = null;
this.audio.src = url;
this.audio.currentTime = t;
this.youtubeVideoUrl = videoUrl;
if (!wasPaused) await this.audio.play();
this.youtubeChapters = res.chapters ?? this.youtubeChapters;
this.youtubeRefreshFailureCount = 0;
this.scheduleYoutubeRefresh(videoId, res.expires_at);
console.info("[study-music] yt refresh ok", { videoId, expires_at: res.expires_at });
} catch (err) {
this.youtubeRefreshFailureCount += 1;
console.warn(
"[study-music] yt refresh failed",
{ videoId, attempt: this.youtubeRefreshFailureCount },
err,
);
if (
this.youtubeRefreshFailureCount >= MusicPlayerStore.YOUTUBE_REFRESH_MAX_FAILURES
) {
try {
this.audio.pause();
} catch {
/* ignore */
}
const track = this.currentTrack;
if (track) {
this.setError(classifyPlayerError("auth_expired", "youtube", track.id));
}
this.youtubeRefreshFailureCount = 0;
return;View on GitHub (pinned to 8600b91f42)