{"record":{"id":"a69a1a0203812586","repo":"tonhowtf/omniget","slug":"player-failed-saving-rpc-update-interval-ms","errorCode":null,"errorMessage":"[player] failed saving rpc update_interval_ms","messagePattern":"\\[player\\] failed saving rpc update_interval_ms","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/study-music/player-store.svelte.ts","lineNumber":868,"sourceCode":"    try {\n      await pluginInvoke(\"study\", \"study:music:rpc:music_settings:set\", {\n        show_buttons: value,\n      });\n    } catch (e) {\n      console.warn(\"[player] failed saving rpc show_buttons\", e);\n    }\n    this.rpcOnPlaybackChange();\n  }\n\n  async setRpcUpdateIntervalMs(ms: number) {\n    const clamped = MusicPlayerStore.clampRpcInterval(ms);\n    this._rpcUpdateIntervalMs = clamped;\n    try {\n      await pluginInvoke(\"study\", \"study:music:rpc:music_settings:set\", {\n        update_interval_ms: clamped,\n      });\n    } catch (e) {\n      console.warn(\"[player] failed saving rpc update_interval_ms\", e);\n    }\n    if (this._rpcTimer !== null) {\n      this.stopRpcLoop();\n      this.startRpcLoop();\n    }\n  }\n\n  private rpcSnapshot(): {\n    title: string;\n    artist: string;\n    album: string;\n    duration: number;\n    position: number;\n    paused: boolean;\n    large_image_key: string | null;\n    large_image_text: string | null;\n    small_image_key: string | null;\n    small_image_text: string | null;","sourceCodeStart":850,"sourceCodeEnd":886,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/study-music/player-store.svelte.ts#L850-L886","documentation":"Warning from the RPC update-interval setter: the clamped interval is applied locally and the RPC loop is restarted, but persisting update_interval_ms via study:music:rpc:music_settings:set failed, so the custom interval resets on next launch.","triggerScenarios":"Calling setRpcUpdateIntervalMs when the backend settings:set command rejects — plugin unavailable, IPC serialization failure, or settings file write error.","commonSituations":"Changing the interval right after app start before the plugin backend is ready; disk or permission issues; plugin version without this command.","solutions":["Wait for backend readiness before saving the interval","Inspect the error for persistence (file write/permission) problems","Retry the save; the runtime loop already uses the new value","Align frontend and plugin versions"],"exampleFix":"// before\nawait pluginInvoke(\"study\", \"study:music:rpc:music_settings:set\", { update_interval_ms: clamped });\n// after\nawait backendReady(\"study\");\nawait pluginInvoke(\"study\", \"study:music:rpc:music_settings:set\", { update_interval_ms: clamped });","handlingStrategy":"validation","validationCode":"const clamped = Math.min(Math.max(ms, MIN_RPC_INTERVAL), MAX_RPC_INTERVAL); if (!Number.isFinite(clamped)) return;","typeGuard":"function isValidInterval(v: unknown): v is number { return typeof v === \"number\" && Number.isFinite(v) && v >= 1000; }","tryCatchPattern":"try { await pluginInvoke(\"study\", \"study:music:rpc:music_settings:set\", { update_interval_ms: clamped }); } catch (e) { console.warn(\"[player] failed saving rpc update_interval_ms\", e); }","preventionTips":["Clamp before sending so backend validation cannot reject the value","Restart the RPC loop only after a successful save if persistence is critical","Wait for plugin readiness on first-run settings writes"],"tags":["ipc","persistence","discord-rpc"],"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"}