tonhowtf/omniget · warning

[omnidisc] deafen failed

Error message

[omnidisc] deafen failed

What it means

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.

Solutions

  1. Inspect errorText(e) in the console for the backend's concrete error.
  2. Gate the deafen toggle on an active voice connection.
  3. Confirm `omnidisc_voice_set_deaf` is registered and its handler handles the not-connected case gracefully.
  4. Verify audio output/input devices exist before deafening.
  5. Avoid testing invoke() from a plain browser; use the Tauri window.

Example fix

// before
deafened = next;
try {
  applyStatus(await invoke<VoiceStatusWire>("omnidisc_voice_set_deaf", { deafened: next }));
} catch (e) {
  deafened = !next;
  console.warn("[omnidisc] deafen failed", errorText(e));
}
// after
if (!connected) return;
deafened = next;
try {
  applyStatus(await invoke<VoiceStatusWire>("omnidisc_voice_set_deaf", { deafened: next }));
} catch (e) {
  deafened = !next;
  notifyUser("Could not change deafen: " + errorText(e));
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!get(voiceConnected)) throw new Error("voice session not active");

Type guard

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

Try / catch

try {
  applyStatus(await invoke<VoiceStatusWire>("omnidisc_voice_set_deaf", { deafened: next }));
} catch (e) {
  deafened = !next;
  console.warn("[omnidisc] deafen failed", errorText(e));
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at src/lib/stores/omnidisc-voice-store.svelte.ts:617

export async function toggleMute(): Promise<void> {
  const next = !muted;
  muted = next;
  try {
    applyStatus(await invoke<VoiceStatusWire>("omnidisc_voice_set_mute", { muted: next }));
  } catch (e) {
    muted = !next;
    console.warn("[omnidisc] mute failed", errorText(e));
  }
}

export async function toggleDeafen(): Promise<void> {
  const next = !deafened;
  deafened = next;
  try {
    applyStatus(await invoke<VoiceStatusWire>("omnidisc_voice_set_deaf", { deafened: next }));
  } catch (e) {
    deafened = !next;
    console.warn("[omnidisc] deafen failed", errorText(e));
  }
}

export function setVolume(userId: string, gain: number) {
  loadVolumes();
  const clamped = Math.min(2, Math.max(0, Number.isFinite(gain) ? gain : 1));
  if (clamped === 1) {
    const next = { ...volumes };
    delete next[userId];
    volumes = next;
  } else {
    volumes = { ...volumes, [userId]: clamped };
  }
  persistVolumes();
  invoke("omnidisc_voice_set_volume", { userId, gain: clamped }).catch((e: unknown) => {
    console.warn("[omnidisc] volume failed", errorText(e));
  });
}

View on GitHub (pinned to 8600b91f42)