Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

Fix crash on launch when no audio input device is present

gabbeaa995fd2b47a
diff --git a/NotchBuddy/Sources/App/Voice/VoiceAudio.swift b/NotchBuddy/Sources/App/Voice/VoiceAudio.swift
index fc7cfbcf..cb1f9662 100644
--- a/NotchBuddy/Sources/App/Voice/VoiceAudio.swift
+++ b/NotchBuddy/Sources/App/Voice/VoiceAudio.swift
@@ -76,7 +76,18 @@ final class VoiceAudio: @unchecked Sendable {
guard !tapInstalled else { return }
let input = engine.inputNode
- let fmt = input.outputFormat(forBus: 0)
+
+ // No input device (e.g. Mac mini with no mic): the hardware format is
+ // 0 ch / 0 Hz and installTap would raise an uncatchable NSException.
+ // Bail out and let the caller show the unavailable state.
+ let hwFmt = input.inputFormat(forBus: 0)
+ guard hwFmt.channelCount > 0, hwFmt.sampleRate > 0 else {
+ appendAppLog("nb.log", "[Voice] no audio input device — pipeline skipped")
+ throw NSError(domain: "VoiceAudio", code: -1,
+ userInfo: [NSLocalizedDescriptionKey: "No audio input device"])
+ }
+
+ let fmt = input.outputFormat(forBus: 0)
// Build a stateful mono 16 kHz Float32 converter for the recognizer.
let target = AVAudioFormat(commonFormat: .pcmFormatFloat32,