{"record":{"id":"713b7630fa5dbbaa","repo":"tonhowtf/omniget","slug":"music-playlists-load-failed","errorCode":null,"errorMessage":"[music] playlists load failed","messagePattern":"\\[music\\] playlists load failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/study-music/playlists-store.svelte.ts","lineNumber":31,"sourceCode":"\nclass PlaylistsStore {\n  list = $state<Playlist[]>([]);\n  loaded = $state(false);\n  loading = $state(false);\n\n  async load(force = false) {\n    if (this.loaded && !force) return;\n    this.loading = true;\n    try {\n      const res = await pluginInvoke<{ playlists: Playlist[] }>(\n        \"study\",\n        \"study:music:playlists:list\",\n      );\n      this.list = res.playlists ?? [];\n      this.loaded = true;\n    } catch (e) {\n      if (import.meta.env.DEV) {\n        console.warn(\"[music] playlists load failed\", e);\n      }\n    } finally {\n      this.loading = false;\n    }\n  }\n\n  async create(name: string, description?: string): Promise<number | null> {\n    try {\n      const res = await pluginInvoke<{ id: number }>(\n        \"study\",\n        \"study:music:playlists:create\",\n        { name, description: description ?? null },\n      );\n      await this.load(true);\n      return res.id;\n    } catch (e) {\n      throw e;\n    }","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/study-music/playlists-store.svelte.ts#L13-L49","documentation":"Warning (dev-only, guarded by import.meta.env.DEV) emitted when the playlists store's load() fails to fetch playlists via pluginInvoke('study','study:music:playlists:list'). this.list stays stale/empty and loaded remains false; in production the failure is silent.","triggerScenarios":"Calling load() (directly or via create/deleteOne/addTrack/removeTrack/reorder/update) when the playlists:list backend command rejects — plugin not initialized, backend error reading the playlists file, or IPC failure.","commonSituations":"Modifying playlists right after app start before the backend is ready; corrupted or unreadable playlists.json; plugin version mismatch removing the list command.","solutions":["Await backend/plugin readiness before the first load()","Check the caught error for file-read/permission problems on the playlists store and repair the file","Update frontend and plugin to matching versions","Note the DEV-only warning: in production add your own error surfacing if you need visibility"],"exampleFix":"// before\nawait playlists.load();\n// after\nawait backendReady(\"study\");\nawait playlists.load();\nif (!playlists.loaded) showPlaylistErrorBanner();","handlingStrategy":"retry","validationCode":"if (!playlists.loaded && !playlists.loading) await playlists.load();","typeGuard":"function isPlaylistList(v: unknown): v is { playlists: Playlist[] } { return typeof v === \"object\" && v !== null && Array.isArray((v as any).playlists); }","tryCatchPattern":"try { await playlists.load(); } catch (e) { console.warn(\"[music] playlists unavailable, using cache\", e); this.list = cachedPlaylists ?? []; }","preventionTips":["Await backend readiness before first load","Cache the last known playlist list for offline/failure fallback","Reserialize/repair the playlists file if parsing errors appear in logs","Don't swallow errors in production builds — add user-visible handling"],"tags":["ipc","persistence","playlists"],"backgroundTag":"file-read-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"}