tonhowtf/omniget · warning

[sc-download-store] listen bulk failed

Error message

[sc-download-store] listen bulk failed

What it means

Logged in download-store.start() when registering the listener for `study-soundcloud-download-bulk-progress` fails. Bulk/batch download progress events are then never delivered, so batch progress UI freezes even though downloads continue in the backend. Non-fatal.

Solutions

  1. Inspect the logged err for the listen() failure cause.
  2. Guard start() to run only in the Tauri webview environment.
  3. Verify the Rust side emits exactly `study-soundcloud-download-bulk-progress`.
  4. Avoid calling start() during unmount; tie listener lifecycle to mounted state.
  5. Retry registration with backoff and show an indeterminate bulk-progress state on failure.

Example fix

// before
} catch (err) {
  console.warn("[sc-download-store] listen bulk failed", err);
}
// after
} catch (err) {
  console.warn("[sc-download-store] listen bulk failed", err);
  this.bulkProgressAvailable = false;
  scheduleRetry(() => this.start());
}
Defensive patterns

Strategy: retry

Validate before calling

if (!isTauri()) return;

Type guard

function isTauri(): boolean {
  return typeof window !== "undefined" && "__TAURI_INTERNALS__" in window;
}

Try / catch

try {
  const bulk = await listen<BulkPayload>("study-soundcloud-download-bulk-progress", (e) => this.handleBulk(e.payload));
  this.listeners.push(bulk);
} catch (err) {
  console.warn("[sc-download-store] listen bulk failed", err);
  scheduleRetry(() => this.start());
}

Prevention

When it happens

Trigger: Calling start() when listen("study-soundcloud-download-bulk-progress") rejects: no Tauri event API (browser dev), webview teardown in progress, or event system error.

Common situations: Browser dev mode; start() racing with stop() during component unmount; Tauri event plugin not initialized; event name mismatch with the Rust emitter.

Related errors


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

Appendix: source

Thrown at src/lib/study-music/download-store.svelte.ts:105

    this.started = true;
    void (async () => {
      try {
        const single = await listen<SinglePayload>(
          "study-soundcloud-download-progress",
          (e) => this.handleSingle(e.payload),
        );
        this.listeners.push(single);
      } catch (err) {
        console.warn("[sc-download-store] listen single failed", err);
      }
      try {
        const bulk = await listen<BulkPayload>(
          "study-soundcloud-download-bulk-progress",
          (e) => this.handleBulk(e.payload),
        );
        this.listeners.push(bulk);
      } catch (err) {
        console.warn("[sc-download-store] listen bulk failed", err);
      }
    })();
  }

  stop() {
    for (const u of this.listeners) {
      try {
        u();
      } catch {
        /* ignore */
      }
    }
    this.listeners = [];
    this.started = false;
  }

  private handleSingle(p: SinglePayload) {
    if (typeof p.job_id !== "number") return;

View on GitHub (pinned to 8600b91f42)