Zackriya-Solutions/meetily · warning · anyhow::Error

Cannot resume when not recording

Error message

Cannot resume when not recording

What it means

resume_recording requires an active recording; is_recording is false. Resume is only valid from the paused state (which implies recording), so resuming after a full stop or before any start is rejected.

Source

Thrown at frontend/src-tauri/src/audio/recording_state.rs:193

    }

    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"));
        }

        // Calculate pause duration and add to total
        if let Some(pause_start) = self.pause_start.lock().unwrap().take() {
            let pause_duration = pause_start.elapsed();
            *self.total_pause_duration.lock().unwrap() += pause_duration;
            log::info!("Recording resumed after pause of {:.2}s", pause_duration.as_secs_f64());
        }

        self.is_paused.store(false, Ordering::SeqCst);
        Ok(())
    }

    pub fn is_recording(&self) -> bool {
        self.is_recording.load(Ordering::SeqCst)

View on GitHub (pinned to 0281737d87)

Solutions

  1. Gate the Resume button on live is_recording state, not cached UI state
  2. If recording already stopped, offer Start Recording instead of resume
  3. Listen for recording-stopped events to clear any paused indicator

Example fix

// before
state.resume_recording()?;

// after - tolerate benign ordering races instead of failing the command
if !state.is_recording() {
    log::warn!("Resume ignored - recording already stopped");
    return Ok(());
}
state.resume_recording()?;
Defensive patterns

Strategy: validation

Validate before calling

// Frontend: gate Resume on a live recording
if (await invoke<boolean>('is_recording')) {
  await invoke('resume_recording');
} else {
  // offer Start Recording instead
}

Try / catch

Match on 'Cannot resume when not recording' and switch the UI to the stopped state (offer Start Recording) rather than showing an error.

Prevention

When it happens

Trigger: Resume clicked after Stop; the session auto-stopped while paused (fatal device error, recording stopped and cleared) and the user then clicks Resume; UI desync where the paused state is shown after the session ended.

Common situations: Device disconnected while paused, auto-stop ran, then the user clicks Resume; frontend kept a paused badge after the backend session ended.

Related errors


AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16). Data as JSON: /api/errors/9e5a64b9890ab6fc. Report an issue: GitHub.