{"record":{"id":"44fe2256d0674506","repo":"Zackriya-Solutions/meetily","slug":"retranscription-already-in-progress","errorCode":null,"errorMessage":"Retranscription already in progress","messagePattern":"Retranscription already in progress","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"frontend/src-tauri/src/audio/retranscription.rs","lineNumber":99,"sourceCode":"    RETRANSCRIPTION_IN_PROGRESS.load(Ordering::SeqCst)\n}\n\n/// Cancel ongoing retranscription\npub fn cancel_retranscription() {\n    RETRANSCRIPTION_CANCELLED.store(true, Ordering::SeqCst);\n}\n\n/// Start retranscription of a meeting's audio\npub async fn start_retranscription<R: Runtime>(\n    app: AppHandle<R>,\n    meeting_id: String,\n    meeting_folder_path: String,\n    language: Option<String>,\n    model: Option<String>,\n    provider: Option<String>,\n) -> Result<RetranscriptionResult> {\n    // Acquire guard - ensures flag is cleared even on panic/early return\n    let _guard = RetranscriptionGuard::acquire().map_err(|e| anyhow!(e))?;\n\n    // Reset cancellation flag\n    RETRANSCRIPTION_CANCELLED.store(false, Ordering::SeqCst);\n\n    let use_parakeet = provider.as_deref() == Some(\"parakeet\");\n    let result = run_retranscription(app.clone(), meeting_id.clone(), meeting_folder_path, language, model, provider).await;\n\n    // Unload the engine after the batch job (success, failure, or cancellation)\n    super::common::unload_engine_after_batch(use_parakeet).await;\n\n    // Guard will automatically clear flag on drop\n    // No need for manual: RETRANSCRIPTION_IN_PROGRESS.store(false, Ordering::SeqCst);\n\n    match &result {\n        Ok(res) => {\n            let _ = app.emit(\n                \"retranscription-complete\",\n                serde_json::json!({","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/retranscription.rs#L81-L117","documentation":"start_retranscription serializes batch jobs with a global RAII guard (RetranscriptionGuard over the RETRANSCRIPTION_IN_PROGRESS AtomicBool). The error means another retranscription is currently running in the process; the guard refuses a second concurrent job. The flag is reliably cleared when the first job's guard drops, so this error means a job is genuinely still running (or hung), not leaked.","triggerScenarios":"Invoking start_retranscription twice (double-click, impatience retry) while the first job is still running; a first job stuck for a long time on decode/VAD/Whisper of a very large meeting file and still holding the guard.","commonSituations":"Retranscribing a 1-hour-plus meeting where progress appears stalled; user re-clicks Retranscribe because the UI gave no in-progress feedback.","solutions":["Check is_retranscription_in_progress_command before starting, and disable the Retranscribe action while true","Cancel the running job first via cancel_retranscription_command, then start the new one","Surface retranscription progress events in the UI so retrying feels unnecessary"],"exampleFix":"// before (frontend)\nawait invoke('start_retranscription', { meetingId, meetingFolderPath });\n\n// after - gate on the in-progress flag\nif (await invoke<boolean>('is_retranscription_in_progress')) {\n  showToast('Retranscription already running - wait or cancel it first');\n  return;\n}\nawait invoke('start_retranscription', { meetingId, meetingFolderPath });","handlingStrategy":"validation","validationCode":"// Frontend: refuse to start while a job runs\nif (await invoke<boolean>('is_retranscription_in_progress')) {\n  showToast('Retranscription already running - cancel it first if needed');\n  return;\n}\nawait invoke('start_retranscription', { meetingId, meetingFolderPath });","typeGuard":null,"tryCatchPattern":"Catch the 'already in progress' error from start_retranscription and offer two user actions: wait (show existing progress) or cancel (invoke cancel_retranscription_command) then retry once.","preventionTips":["Disable the Retranscribe action whenever is_retranscription_in_progress is true","Always show retranscription progress so users never re-click out of uncertainty","Before batch retranscribing multiple meetings, process them sequentially and check the flag between jobs"],"tags":["concurrency","mutex","retranscription","raii-guard"],"backgroundTag":"operation-already-in-progress","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}