{"record":{"id":"96440aa0a9583d7d","repo":"tonhowtf/omniget","slug":"omnidisc-volume-failed","errorCode":null,"errorMessage":"[omnidisc] volume failed","messagePattern":"\\[omnidisc\\] volume failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/lib/stores/omnidisc-voice-store.svelte.ts","lineNumber":633,"sourceCode":"  } 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}\n\nexport async function refreshDevices(): Promise<void> {\n  devicesLoading = true;\n  try {\n    devices = await invoke<AudioDevices>(\"omnidisc_voice_devices\");\n  } catch (e) {\n    console.warn(\"[omnidisc] device list failed\", errorText(e));\n  } finally {\n    devicesLoading = false;\n  }\n}\n\nexport async function setDevice(kind: DeviceKind, id: string | null): Promise<string | null> {\n  const key = kind === \"input\" ? \"input_device\" : \"output_device\";\n  try {\n    await invoke(\"omnidisc_voice_set_device\", { kind, id });","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src/lib/stores/omnidisc-voice-store.svelte.ts#L615-L651","documentation":"Logged in the fire-and-forget catch of setVolume() when `omnidisc_voice_set_volume` rejects. The local volumes map is already updated and persisted, so UI shows the new volume but the backend audio stream keeps the old gain until success. Non-fatal warning.","triggerScenarios":"Calling setVolume(userId, gain) where the backend per-user gain apply fails: unknown/ departed userId in the voice mixer, audio pipeline error, or command not registered.","commonSituations":"Dragging a per-user volume slider for a user who just left the channel; audio engine not yet initialized; Rust handler returned Err applying gain to the mixer.","solutions":["Read errorText(e) output to identify the backend reason (likely unknown user or mixer not ready).","Ignore failures for userIds no longer in the channel; prune volumes for departed users.","Confirm `omnidisc_voice_set_volume` is registered and accepts { userId, gain } with gain in [0,2].","Ensure the audio engine/mixer is initialized before applying per-user volume.","Remove or disable volume controls for users not present in the voice channel."],"exampleFix":"// before\ninvoke(\"omnidisc_voice_set_volume\", { userId, gain: clamped }).catch((e: unknown) => {\n  console.warn(\"[omnidisc] volume failed\", errorText(e));\n});\n// after\nif (!participants.has(userId)) return; // skip volume for departed users\ninvoke(\"omnidisc_voice_set_volume\", { userId, gain: clamped }).catch((e: unknown) => {\n  console.warn(\"[omnidisc] volume failed\", errorText(e));\n  revertLocalVolume(userId);\n});","handlingStrategy":"try-catch","validationCode":"if (!Number.isFinite(gain) || gain < 0 || gain > 2) gain = 1; // clamp before invoke\nif (!participants.has(userId)) return;","typeGuard":"function isValidTarget(userId: string): boolean {\n  return typeof userId === \"string\" && participants.has(userId);\n}","tryCatchPattern":"invoke(\"omnidisc_voice_set_volume\", { userId, gain: clamped }).catch((e: unknown) => {\n  console.warn(\"[omnidisc] volume failed\", errorText(e));\n  revertLocalVolume(userId);\n});","preventionTips":["Clamp gain to [0,2] before sending.","Skip invoke for userIds no longer in the channel.","Revert local volume state on backend failure.","Keep settings persistence and backend state in sync."],"tags":["tauri","ipc","audio","volume"],"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"}