tonhowtf/omniget · warning

[soundcloud] hydrate from cookie manager failed:

Error message

[soundcloud] hydrate from cookie manager failed:

What it means

Warning from SoundcloudStore.tryHydrateFromCookieManager: cookies were read from the system cookie manager but pushing them to the backend via study:soundcloud:auth:set_cookies failed. The method returns false, so the store treats hydration as not-done and the user must log in via webview.

Solutions

  1. Ensure the study plugin backend is initialized before hydration runs
  2. Validate/normalize the cookie objects before JSON.stringify so the backend accepts cookies_json
  3. Fall back to interactive loginWithWebview when hydration returns false (already the designed path)
  4. Check backend logs for why set_cookies rejected the payload

Example fix

// before
await pluginInvoke("study", "study:soundcloud:auth:set_cookies", { cookies_json: JSON.stringify(cookies) });
// after
const normalized = cookies.filter(isValidScCookie).map(({ name, value, domain, path, expires, secure }) => ({ name, value, domain, path, expires, secure }));
if (!normalized.length) return false;
await pluginInvoke("study", "study:soundcloud:auth:set_cookies", { cookies_json: JSON.stringify(normalized) });
Defensive patterns

Strategy: fallback

Validate before calling

const valid = cookies.every(c => c && typeof c.name === "string" && typeof c.value === "string"); if (!valid || !cookies.length) return false;

Type guard

function isCookieArray(v: unknown): v is Array<{ name: string; value: string; domain?: string; path?: string }> { return Array.isArray(v) && v.every(c => typeof c === "object" && c !== null && typeof c.name === "string" && typeof c.value === "string"); }

Try / catch

try { const ok = await tryHydrateFromCookieManager(); if (!ok) await loginWithWebview(); } catch (e) { console.warn("[soundcloud] hydration failed, falling back to webview login", e); await loginWithWebview(); }

Prevention

When it happens

Trigger: Calling hydrated()/tryHydrateFromCookieManager at startup when the set_cookies IPC call rejects — plugin backend unavailable, malformed cookies_json payload, or the backend rejecting the cookie set.

Common situations: Cookie manager returns cookies in an unexpected shape (schema drift) causing backend validation failure; plugin not started yet during early startup; native webview cookie store permission issues.

Related errors


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

Appendix: source

Thrown at src/lib/study-music/soundcloud-store.svelte.ts:216

  async tryHydrateFromCookieManager(): Promise<boolean> {
    try {
      const { invoke } = await import("@tauri-apps/api/core");
      const accounts = await invoke<{ domain: string; accounts: { slug: string }[] }>(
        "cookies_accounts_for_url",
        { url: "https://soundcloud.com/" }
      );
      if (!accounts.accounts.length) return false;
      const slug = accounts.accounts[0].slug;
      const cookies = await invoke<
        { name: string; value: string; domain: string; path: string }[]
      >("cookies_read_as_json", { request: { domain: accounts.domain, slug } });
      if (!cookies.length) return false;
      await pluginInvoke("study", "study:soundcloud:auth:set_cookies", {
        cookies_json: JSON.stringify(cookies),
      });
      return true;
    } catch (e) {
      console.warn("[soundcloud] hydrate from cookie manager failed:", e);
      return false;
    }
  }

  async logout() {
    try {
      await pluginInvoke("study", "study:soundcloud:auth:logout");
    } finally {
      this.profile = null;
      this.likedTracks = [];
      this.playlists = [];
      this.followings = [];
      this.streamFeed = [];
      this.status = { has_client_id: this.status.has_client_id, has_oauth: false, user_id: null };
      this.error = null;
      await this.refreshStatus();
    }
  }

View on GitHub (pinned to 8600b91f42)