Zackriya-Solutions/meetily · warning · anyhow::Error
Cannot pause when not recording
Error message
Cannot pause when not recording
What it means
RecordingState::pause_recording refuses the call because the is_recording AtomicBool is false - there is no active session to pause. The state machine only permits pause from the recording-and-not-paused state, so pausing a stopped or never-started recording is rejected.
Source
Thrown at frontend/src-tauri/src/audio/recording_state.rs:179
pub fn stop_recording(&self) {
self.is_recording.store(false, Ordering::SeqCst);
self.is_paused.store(false, Ordering::SeqCst);
// Clear pause tracking when stopping
*self.pause_start.lock().unwrap() = None;
// CRITICAL: Clear audio sender to close the pipeline channel
// This ensures the pipeline loop exits properly after processing all chunks
*self.audio_sender.lock().unwrap() = None;
// CRITICAL: Clear device references to release microphone/speaker
// Without this, Arc<AudioDevice> references persist and keep the mic active
*self.microphone_device.lock().unwrap() = None;
*self.system_device.lock().unwrap() = None;
*self.disconnected_device.lock().unwrap() = None;
log::info!("Recording stopped, device references cleared");
}
pub fn pause_recording(&self) -> Result<()> {
if !self.is_recording() {
return Err(anyhow::anyhow!("Cannot pause when not recording"));
}
if self.is_paused() {
return Err(anyhow::anyhow!("Recording is already paused"));
}
self.is_paused.store(true, Ordering::SeqCst);
*self.pause_start.lock().unwrap() = Some(Instant::now());
log::info!("Recording paused");
Ok(())
}
pub fn resume_recording(&self) -> Result<()> {
if !self.is_recording() {
return Err(anyhow::anyhow!("Cannot resume when not recording"));
}
if !self.is_paused() {
return Err(anyhow::anyhow!("Recording is not paused"));
}View on GitHub (pinned to 0281737d87)
Solutions
- Derive pause/resume button enablement from backend recording-state events or the is_recording command
- In the command layer, treat 'not recording' pause as a benign no-op with a log line rather than surfacing an error
- Check is_recording before invoking pause from scripts or tests
Example fix
// before
state.pause_recording()?;
// after - tolerate benign ordering races instead of failing the command
if !state.is_recording() {
log::warn!("Pause ignored - recording already stopped");
return Ok(());
}
state.pause_recording()?; Defensive patterns
Strategy: validation
Validate before calling
// Frontend: gate the Pause action on live backend state
if (await invoke<boolean>('is_recording')) {
await invoke('pause_recording');
} Try / catch
Match the returned error string; on 'Cannot pause when not recording' treat as a benign no-op (log, update UI to stopped state) instead of showing a failure.
Prevention
- Enable/disable Pause and Resume buttons from backend recording-state events
- Handle recording-stopped events to clear paused indicators
- Make command handlers idempotent where the state race is benign
When it happens
Trigger: Frontend sends pause_recording after the session already stopped (Stop clicked first, or an auto-stop fired on a fatal pipeline/device error); stale UI still shows a Pause button; double-fire where a stop handler runs before the pause handler.
Common situations: User clicks Stop and Pause almost simultaneously; UI missed the recording-stopped event; automation scripts issuing fixed pause/resume sequences regardless of state.
Related errors
- Cannot resume when not recording
- Recording is already paused
- Recording is not paused
- Recording not active
- No audio streams could be created
AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16).
Data as JSON: /api/errors/8269324a75937630.
Report an issue: GitHub.