tonhowtf/omniget · warning

[study-music] sponsorblock lookup failed:

Error message

[study-music] sponsorblock lookup failed:

What it means

Lookup of SponsorBlock segments for the current YouTube video (via $lib/study-bridge's studyYoutubeSponsorblock) failed; the store logs a warning and continues with empty sponsor segments. Playback is unaffected; only skip-ad/sponsor automation is disabled for that video.

Solutions

  1. Check the logged `err` for network vs backend-command errors.
  2. Retry the lookup after a short delay; SponsorBlock outages are usually transient.
  3. Confirm the backend's SponsorBlock integration is enabled and the service URL is reachable.
  4. Treat empty segments as expected behavior — verify youtubeSponsorBlockSegments stays empty only for videos with no segments.
Defensive patterns

Strategy: try-catch

Validate before calling

if (!videoId || typeof videoId !== "string") return; // skip lookup entirely

Type guard

function hasSegments(res: unknown): res is { segments: unknown[] } {
  return typeof res === "object" && res !== null && Array.isArray((res as any).segments);
}

Try / catch

try {
  const res = await studyYoutubeSponsorblock({ videoId });
  if (this.youtubeCurrentVideoId !== videoId) return;
  this.youtubeSponsorBlockSegments = res.segments ?? [];
} catch (err) {
  console.warn("[study-music] sponsorblock lookup failed:", err);
  this.youtubeSponsorBlockSegments = [];
}

Prevention

When it happens

Trigger: Dynamic import of $lib/study-bridge or studyYoutubeSponsorblock({videoId}) rejecting — backend sponsorblock command missing, network failure to the SponsorBlock service, or IPC error.

Common situations: SponsorBlock API outage or rate limiting on the backend; offline/poor network; stale videoId (video changed mid-lookup, which the code also guards via youtubeCurrentVideoId check); plugin bridge not compiled in.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at src/lib/study-music/player-store.svelte.ts:1693

        }
        this.youtubeRefreshFailureCount = 0;
        return;
      }
      this.cancelYoutubeRefresh();
      this.youtubeRefreshTimer = setTimeout(() => {
        void this.refreshYoutubeStream(videoId);
      }, MusicPlayerStore.YOUTUBE_REFRESH_RETRY_DELAY_SECS * 1000);
    }
  }

  private async refreshYoutubeSponsorBlock(videoId: string) {
    try {
      const { studyYoutubeSponsorblock } = await import("$lib/study-bridge");
      const res = await studyYoutubeSponsorblock({ videoId });
      if (this.youtubeCurrentVideoId !== videoId) return;
      this.youtubeSponsorBlockSegments = res.segments ?? [];
    } catch (err) {
      console.warn("[study-music] sponsorblock lookup failed:", err);
    }
  }

  private async playLocal(track: MusicTrack) {
    if (!this.audio) return;
    await this.stopCurrentPlayback();
    try {
      const isHttpUrl =
        track.path.startsWith("http://") || track.path.startsWith("https://");
      this.audio.src = isHttpUrl ? track.path : convertFileSrc(track.path);
      await this.audio.play();
      this.ensureEqGraph();
      this.saveQueueNow();
      this.updateMediaSessionMetadata(track);
      void this.refreshDominantColor(track);
    } catch (e) {
      this.setError(classifyPlayerError(e, track.source ?? "local", track.id));
    }

View on GitHub (pinned to 8600b91f42)