{"record":{"id":"989bb4a70fd35deb","repo":"tonhowtf/omniget","slug":"player-failed-loading-spotify-settings","errorCode":null,"errorMessage":"[player] failed loading spotify settings","messagePattern":"\\[player\\] failed loading spotify settings","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/study-music/player-store.svelte.ts","lineNumber":743,"sourceCode":"\n  private async loadSpotifySettings() {\n    if (this._spotifySettingsLoaded) return;\n    this._spotifySettingsLoaded = true;\n    try {\n      const res = await pluginInvoke<{\n        heartbeat_enabled?: boolean;\n        heartbeat_interval_ms?: number;\n      }>(\"study\", \"study:music:spotify:settings:get\", {});\n      this._spotifyHeartbeatEnabled = res?.heartbeat_enabled ?? true;\n      const ms = Number(res?.heartbeat_interval_ms ?? 30_000);\n      this._spotifyHeartbeatMs = Number.isFinite(ms)\n        ? Math.min(\n            MusicPlayerStore.SPOTIFY_HEARTBEAT_MAX_MS,\n            Math.max(MusicPlayerStore.SPOTIFY_HEARTBEAT_MIN_MS, ms),\n          )\n        : 30_000;\n    } catch (e) {\n      console.warn(\"[player] failed loading spotify settings\", e);\n    }\n  }\n\n  async setSpotifyHeartbeatEnabled(value: boolean) {\n    this._spotifyHeartbeatEnabled = value;\n    try {\n      await pluginInvoke(\"study\", \"study:music:spotify:settings:set\", {\n        heartbeat_enabled: value,\n      });\n    } catch (e) {\n      console.warn(\"[player] failed saving spotify heartbeat_enabled\", e);\n    }\n    if (value && this.isSpotify() && this._spotifyIsPlaying) {\n      this.startSpotifyHeartbeat();\n    } else if (!value) {\n      this.stopSpotifyHeartbeat();\n    }\n  }","sourceCodeStart":725,"sourceCodeEnd":761,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/study-music/player-store.svelte.ts#L725-L761","documentation":"The Tauri plugin call study:music:spotify:settings:get threw while loading Spotify heartbeat settings into the player store; the error is logged and defaults (heartbeat enabled, 30s interval, clamped to the allowed range) remain in effect. Like the player-settings loader, the _spotifySettingsLoaded flag is set first, so it will not retry this session — purely a best-effort hydration failure.","triggerScenarios":"The settings:get pluginInvoke rejects — plugin unavailable, command missing on the backend, or storage read error.","commonSituations":"Backend version lacking the spotify settings command, plugin not started when loadSpotifySettings runs, or corrupted settings storage.","solutions":["Check the logged cause for plugin vs storage failure","Verify the study plugin exposes study:music:spotify:settings:get","Keep defaults and optionally retry after plugin readiness","Re-save the settings via the UI toggles once the backend is reachable"],"exampleFix":"// before\ncatch (e) {\n  console.warn(\"[player] failed loading spotify settings\", e);\n}\n// after\ncatch (e) {\n  console.warn(\"[player] failed loading spotify settings, using defaults\", e);\n  this._spotifyHeartbeatEnabled = false;\n}","handlingStrategy":"fallback","validationCode":"if (!pluginReady(\"study\")) {\n  console.warn(\"[player] spotify settings unavailable; using defaults\");\n  return;\n}","typeGuard":"function isSpotifySettings(s: unknown): s is { heartbeat_enabled?: boolean; heartbeat_ms?: number } {\n  return !!s && typeof s === \"object\";\n}","tryCatchPattern":"try {\n  const res = await pluginInvoke(\"study\", \"study:music:spotify:settings:get\", {});\n  apply(res);\n} catch (e) {\n  console.warn(\"[player] failed loading spotify settings, using defaults\", e);\n  this._spotifyHeartbeatEnabled = false;\n}","preventionTips":["Initialize spotify setting fields with defaults before loading","Gate settings loads on plugin readiness","Clamp persisted heartbeat_ms to the allowed min/max range","Re-save settings via UI toggles if a load failed"],"tags":["spotify","settings","plugin"],"backgroundTag":"missing-config-value","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"}