{"record":{"id":"53f0ab4aa7a9d279","repo":"tonhowtf/omniget","slug":"omnidisc-call-ring-failed","errorCode":null,"errorMessage":"[omnidisc] call ring failed","messagePattern":"\\[omnidisc\\] call ring failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/stores/omnidisc-voice-store.svelte.ts","lineNumber":500,"sourceCode":"  try {\n    unlisten = await listen<VoiceEventPayload>(\"omnidisc://voice\", (event) => {\n      try {\n        handleEvent(event.payload);\n      } catch (e) {\n        console.warn(\"[omnidisc] voice event failed\", errorText(e));\n      }\n    });\n  } catch (e) {\n    initialized = false;\n    console.warn(\"[omnidisc] could not subscribe to voice events\", errorText(e));\n    return;\n  }\n  try {\n    unlistenDispatch = await listen<DispatchPayload>(\"omnidisc://dispatch\", (event) => {\n      try {\n        handleDispatch(event.payload);\n      } catch (e) {\n        console.warn(\"[omnidisc] call ring failed\", errorText(e));\n      }\n    });\n  } catch (e) {\n    console.warn(\"[omnidisc] could not subscribe to call rings\", errorText(e));\n  }\n  try {\n    applyStatus(await invoke<VoiceStatusWire>(\"omnidisc_voice_status\"));\n  } catch {\n    return;\n  }\n}\n\nexport function teardownVoice() {\n  if (unlisten) unlisten();\n  unlisten = null;\n  if (unlistenDispatch) unlistenDispatch();\n  unlistenDispatch = null;\n  initialized = false;","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/stores/omnidisc-voice-store.svelte.ts#L482-L518","documentation":"The dispatch channel listener (`omnidisc://dispatch`, carrying call rings) wraps handleDispatch in try/catch; a throw inside handleDispatch — typically a malformed DispatchPayload or unhandled ring state — is logged as this warning. The listener remains attached and later events still process.","triggerScenarios":"A dispatch payload that fails handleDispatch's assumptions: ring for an unknown/already-ended call, missing caller id fields, duplicate ring while a session is active, or type skew between Rust DispatchPayload and TS.","commonSituations":"Rapid incoming calls racing the accept/decline state; caller disconnecting between ring emission and handling; added dispatch variants not yet handled in the frontend switch.","solutions":["Log event.payload with the error to find which dispatch variant throws.","Add explicit cases/guards in handleDispatch for unknown or stale rings (ignore instead of throw).","Regenerate DispatchPayload types from the Rust definitions to fix field skew.","Debounce/dedupe rings per caller id before dispatching."],"exampleFix":"// before\nhandleDispatch(event.payload);\n// after\ntry { handleDispatch(event.payload); }\ncatch (e) { console.warn(\"[omnidisc] call ring failed\", errorText(e), event.payload); }","handlingStrategy":"type-guard","validationCode":"function isDispatchPayload(p: unknown): p is DispatchPayload {\n  return typeof p === 'object' && p !== null && 'kind' in p;\n}","typeGuard":"function isDispatchPayload(p: unknown): p is DispatchPayload {\n  return (\n    typeof p === 'object' && p !== null &&\n    'kind' in p && typeof (p as { kind: unknown }).kind === 'string'\n  );\n}","tryCatchPattern":"listen<DispatchPayload>(\"omnidisc://dispatch\", (event) => {\n  try {\n    if (!isDispatchPayload(event.payload)) return;\n    handleDispatch(event.payload);\n  } catch (e) {\n    console.warn(\"[omnidisc] call ring failed\", errorText(e), event.payload);\n  }\n});","preventionTips":["Guard the dispatch payload shape before handling.","Handle stale/duplicate rings (unknown call, session active) by ignoring, not throwing.","Log the payload with the warning to identify failing variants quickly.","Keep the dispatch switch exhaustive with a default no-op case."],"tags":["tauri","events","voice","dispatch"],"backgroundTag":"unexpected-response-shape","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"}