tonhowtf/omniget · warning

[player] failed saving spotify heartbeat_enabled

Error message

[player] failed saving spotify heartbeat_enabled

What it means

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.

Solutions

  1. Check the logged cause (transport vs storage)
  2. Verify the backend implements study:music:spotify:settings:set
  3. Retry the save or re-toggle the setting once the backend responds
  4. Surface a 'preference not saved' hint to the user if persistence keeps failing

Example fix

// before
catch (e) {
  console.warn("[player] failed saving spotify heartbeat_enabled", e);
}
// after
catch (e) {
  console.warn("[player] failed saving spotify heartbeat_enabled", e);
  this._spotifySettingsSaveFailed = true; // re-attempt on next toggle
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof value !== "boolean") throw new TypeError("heartbeat_enabled must be boolean");

Try / catch

try {
  await pluginInvoke("study", "study:music:spotify:settings:set", { heartbeat_enabled: value });
} catch (e) {
  console.warn("[player] failed saving spotify heartbeat_enabled", e);
  queueSaveRetry({ heartbeat_enabled: value });
}

Prevention

When it happens

Trigger: pluginInvoke("study", "study:music:spotify:settings:set", { heartbeat_enabled }) rejects — backend unavailable, command missing, or storage write error.

Common situations: Study plugin not running during the toggle, backend missing the settings:set command, or read-only/full settings storage.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/93e6514144bc5464. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/study-music/player-store.svelte.ts:754

      this._spotifyHeartbeatMs = Number.isFinite(ms)
        ? Math.min(
            MusicPlayerStore.SPOTIFY_HEARTBEAT_MAX_MS,
            Math.max(MusicPlayerStore.SPOTIFY_HEARTBEAT_MIN_MS, ms),
          )
        : 30_000;
    } catch (e) {
      console.warn("[player] failed loading spotify settings", e);
    }
  }

  async setSpotifyHeartbeatEnabled(value: boolean) {
    this._spotifyHeartbeatEnabled = value;
    try {
      await pluginInvoke("study", "study:music:spotify:settings:set", {
        heartbeat_enabled: value,
      });
    } catch (e) {
      console.warn("[player] failed saving spotify heartbeat_enabled", e);
    }
    if (value && this.isSpotify() && this._spotifyIsPlaying) {
      this.startSpotifyHeartbeat();
    } else if (!value) {
      this.stopSpotifyHeartbeat();
    }
  }

  async setSpotifyHeartbeatIntervalMs(ms: number) {
    const clamped = Math.min(
      MusicPlayerStore.SPOTIFY_HEARTBEAT_MAX_MS,
      Math.max(
        MusicPlayerStore.SPOTIFY_HEARTBEAT_MIN_MS,
        Math.floor(Number(ms) || 30_000),
      ),
    );
    this._spotifyHeartbeatMs = clamped;
    try {

View on GitHub (pinned to 8600b91f42)