{"record":{"id":"bb1821df0ab0ca91","repo":"tonhowtf/omniget","slug":"study-music-sponsorblock-lookup-failed","errorCode":null,"errorMessage":"[study-music] sponsorblock lookup failed:","messagePattern":"\\[study-music\\] sponsorblock lookup failed:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/study-music/player-store.svelte.ts","lineNumber":1693,"sourceCode":"        }\n        this.youtubeRefreshFailureCount = 0;\n        return;\n      }\n      this.cancelYoutubeRefresh();\n      this.youtubeRefreshTimer = setTimeout(() => {\n        void this.refreshYoutubeStream(videoId);\n      }, MusicPlayerStore.YOUTUBE_REFRESH_RETRY_DELAY_SECS * 1000);\n    }\n  }\n\n  private async refreshYoutubeSponsorBlock(videoId: string) {\n    try {\n      const { studyYoutubeSponsorblock } = await import(\"$lib/study-bridge\");\n      const res = await studyYoutubeSponsorblock({ videoId });\n      if (this.youtubeCurrentVideoId !== videoId) return;\n      this.youtubeSponsorBlockSegments = res.segments ?? [];\n    } catch (err) {\n      console.warn(\"[study-music] sponsorblock lookup failed:\", err);\n    }\n  }\n\n  private async playLocal(track: MusicTrack) {\n    if (!this.audio) return;\n    await this.stopCurrentPlayback();\n    try {\n      const isHttpUrl =\n        track.path.startsWith(\"http://\") || track.path.startsWith(\"https://\");\n      this.audio.src = isHttpUrl ? track.path : convertFileSrc(track.path);\n      await this.audio.play();\n      this.ensureEqGraph();\n      this.saveQueueNow();\n      this.updateMediaSessionMetadata(track);\n      void this.refreshDominantColor(track);\n    } catch (e) {\n      this.setError(classifyPlayerError(e, track.source ?? \"local\", track.id));\n    }","sourceCodeStart":1675,"sourceCodeEnd":1711,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/study-music/player-store.svelte.ts#L1675-L1711","documentation":"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.","triggerScenarios":"Dynamic import of $lib/study-bridge or studyYoutubeSponsorblock({videoId}) rejecting — backend sponsorblock command missing, network failure to the SponsorBlock service, or IPC error.","commonSituations":"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.","solutions":["Check the logged `err` for network vs backend-command errors.","Retry the lookup after a short delay; SponsorBlock outages are usually transient.","Confirm the backend's SponsorBlock integration is enabled and the service URL is reachable.","Treat empty segments as expected behavior — verify youtubeSponsorBlockSegments stays empty only for videos with no segments."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!videoId || typeof videoId !== \"string\") return; // skip lookup entirely","typeGuard":"function hasSegments(res: unknown): res is { segments: unknown[] } {\n  return typeof res === \"object\" && res !== null && Array.isArray((res as any).segments);\n}","tryCatchPattern":"try {\n  const res = await studyYoutubeSponsorblock({ videoId });\n  if (this.youtubeCurrentVideoId !== videoId) return;\n  this.youtubeSponsorBlockSegments = res.segments ?? [];\n} catch (err) {\n  console.warn(\"[study-music] sponsorblock lookup failed:\", err);\n  this.youtubeSponsorBlockSegments = [];\n}","preventionTips":["Treat SponsorBlock as optional: always default segments to empty on failure.","Add a timeout to the lookup so slow SponsorBlock responses don't block playback.","Drop stale lookups when the current video changes (already done via videoId check).","Cache segments per videoId to reduce repeat calls."],"tags":["sponsorblock","network","youtube","graceful-degradation"],"backgroundTag":"api-request-failed","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}