{"record":{"id":"f5bea0917edca140","repo":"tonhowtf/omniget","slug":"sc-download-store-listen-single-failed","errorCode":null,"errorMessage":"[sc-download-store] listen single failed","messagePattern":"\\[sc-download-store\\] listen single failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/study-music/download-store.svelte.ts","lineNumber":96,"sourceCode":"  drawerOpen = $state(false);\n\n  private pendingByTrackId = new Map<number, string>();\n  private listeners: UnlistenFn[] = [];\n  private nonce = 0;\n  private started = false;\n\n  start() {\n    if (this.started) return;\n    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 {","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/study-music/download-store.svelte.ts#L78-L114","documentation":"Logged in download-store.start() when registering the Tauri event listener for `study-soundcloud-download-progress` via listen() fails. Without this listener, single-download progress events are never received, so per-track progress UI silently stalls. Non-fatal warning; the store keeps running.","triggerScenarios":"Calling start() when listen(\"study-soundcloud-download-progress\") rejects: webview event API unavailable (browser dev), app window closing, or Tauri event system error.","commonSituations":"Running the app in a plain browser where Tauri listen() is unavailable; calling start() during teardown; duplicated event names / plugin registration problems.","solutions":["Check the logged err for the listen() failure reason.","Only call start() inside the Tauri webview (guard on window.__TAURI__ availability).","Ensure `study-soundcloud-download-progress` events are emitted with a matching event name from Rust.","Retry listener registration with a small backoff; transient failures can occur at startup.","Add a fallback UI state (e.g. 'progress unavailable') when listeners fail so the UI doesn't stall silently."],"exampleFix":"// before\n} catch (err) {\n  console.warn(\"[sc-download-store] listen single failed\", err);\n}\n// after\n} catch (err) {\n  console.warn(\"[sc-download-store] listen single failed\", err);\n  this.progressAvailable = false;\n  scheduleRetry(() => this.start()); // re-register listeners after transient failure\n}","handlingStrategy":"retry","validationCode":"if (!isTauri()) return; // listen() is unavailable outside the Tauri webview","typeGuard":"function isTauri(): boolean {\n  return typeof window !== \"undefined\" && \"__TAURI_INTERNALS__\" in window;\n}","tryCatchPattern":"try {\n  const single = await listen<SinglePayload>(\"study-soundcloud-download-progress\", (e) => this.handleSingle(e.payload));\n  this.listeners.push(single);\n} catch (err) {\n  console.warn(\"[sc-download-store] listen single failed\", err);\n  scheduleRetry(() => this.start());\n}","preventionTips":["Only register event listeners inside the Tauri webview.","Unregister listeners in stop() to avoid duplicate handlers on re-start.","Retry listener registration with backoff at startup.","Match event names exactly between Rust emitter and JS listener."],"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"}