{"record":{"id":"71b00279c9123ab0","repo":"jamiepine/voicebox","slug":"system-audio-capture-is-only-available-in-the-desk","errorCode":null,"errorMessage":"System audio capture is only available in the desktop app.","messagePattern":"System audio capture is only available in the desktop app\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web/src/platform/audio.ts","lineNumber":9,"sourceCode":"import type { PlatformAudio, AudioDevice } from '@/platform/types';\n\nexport const webAudio: PlatformAudio = {\n  async isSystemAudioSupported(): Promise<boolean> {\n    return false; // System audio capture not supported in web\n  },\n\n  async startSystemAudioCapture(_maxDurationSecs: number): Promise<void> {\n    throw new Error('System audio capture is only available in the desktop app.');\n  },\n\n  async stopSystemAudioCapture(): Promise<Blob> {\n    throw new Error('System audio capture is only available in the desktop app.');\n  },\n\n  async listOutputDevices(): Promise<AudioDevice[]> {\n    return []; // No native device routing in web\n  },\n\n  async playToDevices(_audioData: Uint8Array, _deviceIds: string[]): Promise<void> {\n    throw new Error('Native audio device routing is only available in the desktop app.');\n  },\n\n  stopPlayback(): void {\n    // No-op for web\n  },\n};","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/jamiepine/voicebox/blob/51f49dea198384b4eb6087b72c17057c6eb1c1cd/web/src/platform/audio.ts#L1-L27","documentation":"Thrown by webAudio.startSystemAudioCapture() — the web platform stub of PlatformAudio. The browser cannot capture system/desktop audio (no equivalent to the Tauri desktop loopback), so this method is an unconditional throw. The companion isSystemAudioSupported() returns false and listOutputDevices() returns []; these are the supported capability probes a caller must check first.","triggerScenarios":"Code path running on the web build calls startSystemAudioCapture(maxDurationSecs) directly. This happens when platform-agnostic code forgets to gate on isSystemAudioSupported() or when the wrong platform implementation is injected (web build used where desktop was expected).","commonSituations":"A feature developed against the Tauri desktop build is exercised in the web build. The platform PlatformAudio binding falls back to webAudio because the desktop module wasn't bundled. A user opens the web UI expecting system-audio capture that only exists in the desktop app.","solutions":["Gate the call behind isSystemAudioSupported() and disable the UI affordance when it returns false.","Confirm the platform resolver injects the desktop audio implementation inside the Tauri build, not webAudio.","Surface an in-app message directing the user to the desktop app for system-audio capture.","Provide a web alternative (getUserMedia microphone capture) where system audio is not strictly required."],"exampleFix":"// before\nawait platform.audio.startSystemAudioCapture(30);\n// after\nif (!(await platform.audio.isSystemAudioSupported())) {\n  toast({ title: 'System audio capture needs the desktop app.' });\n  return;\n}\nawait platform.audio.startSystemAudioCapture(30);","handlingStrategy":"validation","validationCode":"async function canCaptureSystemAudio(audio: PlatformAudio): Promise<boolean> {\n  try {\n    return await audio.isSystemAudioSupported();\n  } catch {\n    return false;\n  }\n}\n// Guard every entry point:\nif (!(await canCaptureSystemAudio(platform.audio))) {\n  toast({ title: 'System audio capture needs the desktop app.' });\n  return;\n}","typeGuard":null,"tryCatchPattern":"if (!(await platform.audio.isSystemAudioSupported())) {\n  toast({ title: 'System audio capture is desktop-only.' });\n  return;\n}\ntry {\n  await platform.audio.startSystemAudioCapture(30);\n} catch (e) {\n  toast({ title: 'Capture failed', description: (e as Error).message, variant: 'destructive' });\n}","preventionTips":["Always gate startSystemAudioCapture on isSystemAudioSupported().","Inject the correct platform audio impl per build (webAudio for web, desktop impl for Tauri).","Hide the system-audio UI affordance when the capability probe is false."],"tags":["platform","audio","web","capability","typescript","desktop-only"],"backgroundTag":null,"analyzedSha":"51f49dea198384b4eb6087b72c17057c6eb1c1cd","analyzedAt":"2026-08-12T16:51:42.824Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}