{"record":{"id":"c5b1dd97c557cfe4","repo":"tonhowtf/omniget","slug":"sc-download-store-listen-bulk-failed","errorCode":null,"errorMessage":"[sc-download-store] listen bulk failed","messagePattern":"\\[sc-download-store\\] listen bulk failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/study-music/download-store.svelte.ts","lineNumber":105,"sourceCode":"    this.started = true;\n    void (async () => {\n      try {\n        const single = await listen<SinglePayload>(\n          \"study-soundcloud-download-progress\",\n          (e) => this.handleSingle(e.payload),\n        );\n        this.listeners.push(single);\n      } catch (err) {\n        console.warn(\"[sc-download-store] listen single failed\", err);\n      }\n      try {\n        const bulk = await listen<BulkPayload>(\n          \"study-soundcloud-download-bulk-progress\",\n          (e) => this.handleBulk(e.payload),\n        );\n        this.listeners.push(bulk);\n      } catch (err) {\n        console.warn(\"[sc-download-store] listen bulk failed\", err);\n      }\n    })();\n  }\n\n  stop() {\n    for (const u of this.listeners) {\n      try {\n        u();\n      } catch {\n        /* ignore */\n      }\n    }\n    this.listeners = [];\n    this.started = false;\n  }\n\n  private handleSingle(p: SinglePayload) {\n    if (typeof p.job_id !== \"number\") return;","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/study-music/download-store.svelte.ts#L87-L123","documentation":"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.","triggerScenarios":"Calling start() when listen(\"study-soundcloud-download-bulk-progress\") rejects: no Tauri event API (browser dev), webview teardown in progress, or event system error.","commonSituations":"Browser dev mode; start() racing with stop() during component unmount; Tauri event plugin not initialized; event name mismatch with the Rust emitter.","solutions":["Inspect the logged err for the listen() failure cause.","Guard start() to run only in the Tauri webview environment.","Verify the Rust side emits exactly `study-soundcloud-download-bulk-progress`.","Avoid calling start() during unmount; tie listener lifecycle to mounted state.","Retry registration with backoff and show an indeterminate bulk-progress state on failure."],"exampleFix":"// before\n} catch (err) {\n  console.warn(\"[sc-download-store] listen bulk failed\", err);\n}\n// after\n} catch (err) {\n  console.warn(\"[sc-download-store] listen bulk failed\", err);\n  this.bulkProgressAvailable = false;\n  scheduleRetry(() => this.start());\n}","handlingStrategy":"retry","validationCode":"if (!isTauri()) return;","typeGuard":"function isTauri(): boolean {\n  return typeof window !== \"undefined\" && \"__TAURI_INTERNALS__\" in window;\n}","tryCatchPattern":"try {\n  const bulk = await listen<BulkPayload>(\"study-soundcloud-download-bulk-progress\", (e) => this.handleBulk(e.payload));\n  this.listeners.push(bulk);\n} catch (err) {\n  console.warn(\"[sc-download-store] listen bulk failed\", err);\n  scheduleRetry(() => this.start());\n}","preventionTips":["Tie listener lifecycle to component mount/unmount, not ad-hoc start/stop.","Avoid start()/stop() races with an idempotent started flag.","Verify the Rust emitter uses the exact bulk event name.","Provide an indeterminate UI state when bulk progress listeners are down."],"tags":["tauri","events","ipc","soundcloud"],"backgroundTag":"ipc-listen-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"}