{"record":{"id":"88368c650f3c87fe","repo":"tonhowtf/omniget","slug":"omnidisc-deafen-failed","errorCode":null,"errorMessage":"[omnidisc] deafen failed","messagePattern":"\\[omnidisc\\] deafen failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/stores/omnidisc-voice-store.svelte.ts","lineNumber":617,"sourceCode":"export async function toggleMute(): Promise<void> {\n  const next = !muted;\n  muted = next;\n  try {\n    applyStatus(await invoke<VoiceStatusWire>(\"omnidisc_voice_set_mute\", { muted: next }));\n  } catch (e) {\n    muted = !next;\n    console.warn(\"[omnidisc] mute failed\", errorText(e));\n  }\n}\n\nexport async function toggleDeafen(): Promise<void> {\n  const next = !deafened;\n  deafened = next;\n  try {\n    applyStatus(await invoke<VoiceStatusWire>(\"omnidisc_voice_set_deaf\", { deafened: next }));\n  } catch (e) {\n    deafened = !next;\n    console.warn(\"[omnidisc] deafen failed\", errorText(e));\n  }\n}\n\nexport function setVolume(userId: string, gain: number) {\n  loadVolumes();\n  const clamped = Math.min(2, Math.max(0, Number.isFinite(gain) ? gain : 1));\n  if (clamped === 1) {\n    const next = { ...volumes };\n    delete next[userId];\n    volumes = next;\n  } else {\n    volumes = { ...volumes, [userId]: clamped };\n  }\n  persistVolumes();\n  invoke(\"omnidisc_voice_set_volume\", { userId, gain: clamped }).catch((e: unknown) => {\n    console.warn(\"[omnidisc] volume failed\", errorText(e));\n  });\n}","sourceCodeStart":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/stores/omnidisc-voice-store.svelte.ts#L599-L635","documentation":"Logged by toggleDeafen() when the Tauri IPC command `omnidisc_voice_set_deaf` fails. Like toggleMute, it optimistically sets `deafened` and reverts on failure. The user's deafen state is unchanged on the backend, and this is a non-fatal warning.","triggerScenarios":"Calling toggleDeafen() when the backend command `omnidisc_voice_set_deaf` returns Err: no active voice session, audio subsystem error, or Rust handler failure (e.g. cannot apply deafen to the audio pipeline).","commonSituations":"Clicking deafen right after leaving a voice channel; audio device removed mid-session; backend handler panics or command not registered; running in plain browser during dev.","solutions":["Inspect errorText(e) in the console for the backend's concrete error.","Gate the deafen toggle on an active voice connection.","Confirm `omnidisc_voice_set_deaf` is registered and its handler handles the not-connected case gracefully.","Verify audio output/input devices exist before deafening.","Avoid testing invoke() from a plain browser; use the Tauri window."],"exampleFix":"// before\ndeafened = next;\ntry {\n  applyStatus(await invoke<VoiceStatusWire>(\"omnidisc_voice_set_deaf\", { deafened: next }));\n} catch (e) {\n  deafened = !next;\n  console.warn(\"[omnidisc] deafen failed\", errorText(e));\n}\n// after\nif (!connected) return;\ndeafened = next;\ntry {\n  applyStatus(await invoke<VoiceStatusWire>(\"omnidisc_voice_set_deaf\", { deafened: next }));\n} catch (e) {\n  deafened = !next;\n  notifyUser(\"Could not change deafen: \" + errorText(e));\n}","handlingStrategy":"try-catch","validationCode":"if (!get(voiceConnected)) throw new Error(\"voice session not active\");","typeGuard":"function isTauri(): boolean {\n  return typeof window !== \"undefined\" && \"__TAURI_INTERNALS__\" in window;\n}","tryCatchPattern":"try {\n  applyStatus(await invoke<VoiceStatusWire>(\"omnidisc_voice_set_deaf\", { deafened: next }));\n} catch (e) {\n  deafened = !next;\n  console.warn(\"[omnidisc] deafen failed\", errorText(e));\n}","preventionTips":["Disable deafen toggle when no session is active.","Roll back optimistic deafened state on failure.","Verify audio devices exist before enabling voice controls.","Register and unit-test all omnidisc_voice_* Tauri commands."],"tags":["tauri","ipc","audio","voice"],"backgroundTag":"api-request-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"}