Skip to content

fix: show friendly error when no audio input device is available#1115

Merged
cjpais merged 1 commit intocjpais:mainfrom
MarceloPrado:fix/friendly-no-mic-error
Mar 22, 2026
Merged

fix: show friendly error when no audio input device is available#1115
cjpais merged 1 commit intocjpais:mainfrom
MarceloPrado:fix/friendly-no-mic-error

Conversation

@MarceloPrado
Copy link
Copy Markdown
Contributor

@MarceloPrado MarceloPrado commented Mar 22, 2026

Summary

  • Adds a pre-flight check in start_microphone_stream() to detect when no audio input devices exist before hitting coreaudio
  • Introduces a new no_input_device error type (following the existing microphone_permission_denied pattern)
  • Shows a clear, actionable toast: "No Microphone Found" with a description guiding the user to connect a mic
  • Adds translations for all 17 supported locales

Fixes #1114

⚠️ I have not validated the i18n keys besides en-US and pt-BR - they were all AI-gen

Changes

Backend (Rust):

  • recorder.rs — Added is_no_input_device_error() detection helper + 3 unit tests
  • managers/audio.rs — Pre-flight device enumeration check before rec.open()
  • actions.rs — New "no_input_device" error type classification
  • audio/mod.rs, audio_toolkit/mod.rs — Re-exports

Frontend (React/TS):

  • App.tsx — New else if branch for the no_input_device error type
  • All 17 translation.json files — Added noInputDeviceTitle and noInputDevice i18n keys

Before / After

Before: Failed to start recording: Failed to open recorder: Failed to fetch preferred config: A backend-specific error has occurred: An unknown error unknown to the coreaudio-rs API occurred

After: No Microphone Found — No audio input device was detected. Please connect a microphone or headset and try again.

Test plan

  • cargo test -- recorder::tests — all 7 tests pass (including 3 new ones)
  • bun run lint — passes clean
  • Manual test on a machine without a mic (e.g., Mac Studio with no external mic): trigger recording → verify the friendly toast appears

When recording on a machine without a microphone (e.g. Mac Studio with
no external mic), the app previously showed a cryptic coreaudio-rs error.
Now it shows a clear, actionable toast: "No Microphone Found — Please
connect a microphone or headset and try again."

Fixes cjpais#1114
@cjpais
Copy link
Copy Markdown
Owner

cjpais commented Mar 22, 2026

Thanks for this, used to be a crash, then cryptic error, and now nice error. Thanks for your fix

@cjpais cjpais merged commit f6e7186 into cjpais:main Mar 22, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cryptic error when no audio input device is available

2 participants