Skip to content

[BUG] Microphone disconnection leaves audio stream stuck, causing silent failures and preventing new recordings #1743

Description

@jandak377

Bug Description

When a USB microphone temporarily disconnects or drops hardware connection during an active session (or right at computer startup), Handy does not handle the stream drop gracefully.

What happens:

  1. The physical mic disconnects mid-recording or drops connection.

  2. The recording fails silently and outputs sample count: 0.

  3. Upon stopping, the app fails to transcribe (stop() failed: sending on a closed channel) because no samples were retrieved.

  4. App lock-up state: For subsequent recording attempts, the app remains stuck believing the old stream is still active (Microphone stream already active -> Failed to start recording: Recorder not available).

  5. The user cannot record again until the internal stream timeout finishes and resets the audio manager (approx. 1–2 minutes later).

Expected Behavior:
If an active microphone disconnects, Handy should detect the broken stream, reset the stream flag gracefully, prompt/notify the user, and re-initialize the audio device (or switch back to system default) without locking up subsequent record hotkey actions.


System Information

  • App Version: 0.9.3

  • Operating System: Windows 11

  • CPU: AMD Ryzen 7

  • GPU: NVIDIA GeForce GTX 1660 Ti


Logs

1. Stream Disconnection & Recorder Lock-up State:
[2026-07-20][06:10:09][handy_app_lib::audio_toolkit::audio::recorder][ERROR] Stream error: The requested device is no longer available. For example, it has been unplugged.
[2026-07-20][06:10:12][handy_app_lib::actions][DEBUG] TranscribeAction::start called for binding: transcribe
[2026-07-20][06:10:12][handy_app_lib::managers::audio][DEBUG] Microphone stream already active
[2026-07-20][06:10:12][handy_app_lib::actions][DEBUG] Failed to start recording: Recorder not available
[2026-07-20][06:10:12][handy_app_lib::transcription_coordinator][DEBUG] Start for 'transcribe' did not begin recording; staying idle
[2026-07-20][06:10:34][handy_app_lib::managers::audio][DEBUG] Microphone stream stopped
[2026-07-20][06:10:34][handy_app_lib::managers::audio][DEBUG] device resolve: no mic configured -> system default

2. Mid-Session Disconnect & Zero-Sample Channel Error:
[2026-07-20][20:43:32][handy_app_lib::audio_toolkit::audio::recorder][INFO] Using device: Ok("Microphone (USB Condenser Microphone)")
Sample rate: 48000
Channels: 2
Format: F32
[2026-07-20][20:43:37][handy_app_lib::audio_toolkit::audio::recorder][ERROR] Stream error: The requested device is no longer available. For example, it has been unplugged.
[2026-07-20][20:44:15][handy_app_lib::actions][DEBUG] TranscribeAction::stop called for binding: transcribe
[2026-07-20][20:44:15][handy_app_lib::managers::audio][ERROR] stop() failed: sending on a closed channel
[2026-07-20][20:44:15][handy_app_lib::actions][DEBUG] Recording stopped and samples retrieved in 241.4µs, sample count: 0
[2026-07-20][20:44:15][handy_app_lib::actions][DEBUG] Recording produced no audio samples; skipping persistence
[2026-07-20][20:44:33][handy_app_lib::actions][DEBUG] TranscribeAction::start called for binding: transcribe
[2026-07-20][20:44:33][handy_app_lib::managers::audio][DEBUG] Microphone stream already active
[2026-07-20][20:44:33][handy_app_lib::actions][DEBUG] Failed to start recording: Recorder not available
[2026-07-20][20:44:33][handy_app_lib::transcription_coordinator][DEBUG] Start for 'transcribe' did not begin recording; staying idle

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions