{"record":{"id":"93e6514144bc5464","repo":"tonhowtf/omniget","slug":"player-failed-saving-spotify-heartbeat-enabled","errorCode":null,"errorMessage":"[player] failed saving spotify heartbeat_enabled","messagePattern":"\\[player\\] failed saving spotify heartbeat_enabled","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/study-music/player-store.svelte.ts","lineNumber":754,"sourceCode":"      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  }\n\n  async setSpotifyHeartbeatIntervalMs(ms: number) {\n    const clamped = Math.min(\n      MusicPlayerStore.SPOTIFY_HEARTBEAT_MAX_MS,\n      Math.max(\n        MusicPlayerStore.SPOTIFY_HEARTBEAT_MIN_MS,\n        Math.floor(Number(ms) || 30_000),\n      ),\n    );\n    this._spotifyHeartbeatMs = clamped;\n    try {","sourceCodeStart":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/study-music/player-store.svelte.ts#L736-L772","documentation":"Non-fatal warning: persisting the new heartbeat_enabled value via study:music:spotify:settings:set failed. The in-memory flag is already applied and heartbeat start/stop proceeds regardless, but the preference may not survive restart.","triggerScenarios":"pluginInvoke(\"study\", \"study:music:spotify:settings:set\", { heartbeat_enabled }) rejects — backend unavailable, command missing, or storage write error.","commonSituations":"Study plugin not running during the toggle, backend missing the settings:set command, or read-only/full settings storage.","solutions":["Check the logged cause (transport vs storage)","Verify the backend implements study:music:spotify:settings:set","Retry the save or re-toggle the setting once the backend responds","Surface a 'preference not saved' hint to the user if persistence keeps failing"],"exampleFix":"// before\ncatch (e) {\n  console.warn(\"[player] failed saving spotify heartbeat_enabled\", e);\n}\n// after\ncatch (e) {\n  console.warn(\"[player] failed saving spotify heartbeat_enabled\", e);\n  this._spotifySettingsSaveFailed = true; // re-attempt on next toggle\n}","handlingStrategy":"try-catch","validationCode":"if (typeof value !== \"boolean\") throw new TypeError(\"heartbeat_enabled must be boolean\");","typeGuard":null,"tryCatchPattern":"try {\n  await pluginInvoke(\"study\", \"study:music:spotify:settings:set\", { heartbeat_enabled: value });\n} catch (e) {\n  console.warn(\"[player] failed saving spotify heartbeat_enabled\", e);\n  queueSaveRetry({ heartbeat_enabled: value });\n}","preventionTips":["Apply the in-memory change immediately, persist asynchronously","Queue a retry when persistence fails so the preference eventually saves","Notify the user if a preference could not be persisted","Verify backend implements the settings:set command before release"],"tags":["spotify","settings-persistence","plugin"],"backgroundTag":"database-write-failed","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"}