{"record":{"id":"61c573dd79432e2d","repo":"tonhowtf/omniget","slug":"track-sem-metadata-pra-resolver-no-youtube","errorCode":null,"errorMessage":"Track sem metadata pra resolver no YouTube","messagePattern":"Track sem metadata pra resolver no YouTube","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/study-music/spotify-store.svelte.ts","lineNumber":128,"sourceCode":"  const cover = pickImage(track.album.images, 300);\n  return {\n    id: hashStringToInt(track.uri),\n    path: track.uri,\n    title: track.name,\n    artist: track.artists.map((a) => a.name).join(\", \"),\n    album: track.album.name,\n    duration_ms: track.duration_ms,\n    cover_path: null,\n    source: \"spotify\",\n    spotify_uri: track.uri,\n    spotify_cover_url: cover ?? undefined,\n    isrc: track.isrc,\n  };\n}\n\nasync function resolveSpotifyToYoutube(track: MusicTrack): Promise<string> {\n  if (!track.title || !track.artist) {\n    throw new Error(\"Track sem metadata pra resolver no YouTube\");\n  }\n  console.log(\"[spotify-yt] resolving:\", {\n    title: track.title,\n    artist: track.artist,\n    isrc: track.isrc,\n    duration_ms: track.duration_ms,\n  });\n  const res = await pluginInvoke<{\n    youtube_url: string;\n    video_id: string;\n    video_title: string;\n    channel: string;\n    score: number;\n  }>(\"study\", \"study:spotify:resolve_youtube\", {\n    title: track.title,\n    artist: track.artist,\n    durationMs: track.duration_ms ?? 0,\n    isrc: track.isrc,","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/study-music/spotify-store.svelte.ts#L110-L146","documentation":"Raised by download when the MediaInfo produced by native_get_media_info has an empty available_qualities list. The download flow picks the requested quality or falls back to the first entry; with no entries at all there is nothing to download, so it errors.","triggerScenarios":"info.available_qualities.first() returns None — the media-info step completed but produced zero video qualities, typically because clip GET responses contained no selectable renditions.","commonSituations":"Clip whose formats were stripped by Twitch (e.g. muted/metadata-only clips); token built with wrong signature/value causing rendition discovery to fail silently upstream; fetch succeeded but quality parsing filtered everything out; empty-required-field style gaps from an unexpected GQL shape.","solutions":["Check upstream parsing: log how many qualities were discovered and why entries were filtered out.","Validate the access token/URL construction — invalid tokens can lead to responses with no playable renditions.","Verify with a browser/VLC that the clip actually has downloadable renditions.","Fail early in native_get_media_info with a clearer 'no renditions' error instead of surfacing in download."],"exampleFix":"// before\nlet first = info\n    .available_qualities\n    .first()\n    .ok_or_else(|| anyhow!(\"No media URL available\"))?;\n// after\nif info.available_qualities.is_empty() {\n    anyhow::bail!(\"Clip has no downloadable renditions (slug: {}) — it may be muted or removed\", slug);\n}\nlet first = &info.available_qualities[0];","handlingStrategy":"validation","validationCode":"// Before download, ensure at least one rendition exists\nif media_info.available_qualities.is_empty() {\n    return Err(\"no downloadable renditions for this clip\");\n}","typeGuard":"fn has_renditions(info: &MediaInfo) -> bool {\n    !info.available_qualities.is_empty()\n}","tryCatchPattern":"// Fall back with a clear user message\nmatch download(url, opts).await {\n    Err(e) if e.to_string() == \"No media URL available\" => {\n        ui.show(\"This clip has no downloadable streams — it may be muted or removed\");\n    }\n    other => other?,\n}","preventionTips":["Check media info qualities right after fetching, not at download time","Verify clips are actually playable (browser/VLC) in batch pipelines","Log how renditions are parsed so filtering bugs surface early","Skip clips that yield zero qualities instead of retrying"],"tags":["twitch","download","empty-list","rust"],"backgroundTag":"empty-result-set","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}