{"record":{"id":"b26eefe35c779899","repo":"Zackriya-Solutions/meetily","slug":"vad-processing-cancelled","errorCode":null,"errorMessage":"VAD processing cancelled","messagePattern":"VAD processing cancelled","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"info","filePath":"frontend/src-tauri/src/audio/vad.rs","lineNumber":390,"sourceCode":"\n            // Warn if chunk processing took too long (>1 second)\n            if elapsed.as_secs() > 1 {\n                warn!(\"VAD: Chunk {} took {:?} - possible performance issue\", chunk_count, elapsed);\n            }\n\n            all_segments.extend(segments);\n\n            processed += chunk.len();\n            let progress = ((processed * 100) / total_samples) as u32;\n\n            // Call progress callback every 5%\n            if progress >= last_progress + 5 {\n                debug!(\"VAD: Progress {}% ({} segments found so far)\", progress, all_segments.len());\n\n                // Check for cancellation\n                if !progress_callback(progress, all_segments.len()) {\n                    info!(\"VAD: Cancelled by callback at {}%\", progress);\n                    return Err(anyhow!(\"VAD processing cancelled\"));\n                }\n\n                last_progress = progress;\n            }\n        }\n\n        let final_segments = processor.flush()?;\n        all_segments.extend(final_segments);\n\n        info!(\"VAD: Complete! Found {} speech segments\", all_segments.len());\n    } else {\n        // Small file - process all at once\n        all_segments = processor.process_audio(samples_mono_16k)?;\n        let final_segments = processor.flush()?;\n        all_segments.extend(final_segments);\n    }\n\n    Ok(all_segments)","sourceCodeStart":372,"sourceCodeEnd":408,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/vad.rs#L372-L408","documentation":"This is not a failure: the file-scope VAD pass aborted because the progress callback returned false at a >=5% progress checkpoint. The caller deliberately cancels - typically the UI cancelling a retranscription or VAD job on a large audio file.","triggerScenarios":"A progress_callback closure returns false (user pressed Cancel in the retranscription UI) once progress advances by at least 5%, triggering the early return with this message.","commonSituations":"User cancels retranscription of a large recording; the frontend tears down a view and its callback returns false to stop background work.","solutions":["Handle it as a distinct 'cancelled' outcome in the UI, not an error toast","Use a dedicated error variant (e.g. VadError::Cancelled) instead of an anyhow string so callers can match on it","Return the partial segments found so far if partial results are useful"],"exampleFix":"// before\nif !progress_callback(progress, all_segments.len()) {\n    return Err(anyhow!(\"VAD processing cancelled\"));\n}\n\n// after - a dedicated variant so callers distinguish cancellation from real errors\n#[derive(thiserror::Error, Debug)]\nenum VadError {\n    #[error(\"cancelled by caller at {progress}%\")]\n    Cancelled { progress: u32 },\n    #[error(transparent)]\n    Other(#[from] anyhow::Error),\n}\n\nif !progress_callback(progress, all_segments.len()) {\n    return Err(VadError::Cancelled { progress }.into());\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Distinguish cancellation from real failures\nmatch detect_speech_segments_with_progress(data, cb).await {\n    Ok(segs) => { /* done */ }\n    Err(e) if e.to_string().contains(\"cancelled\") => {\n        info!(\"VAD cancelled by user\"); // show 'Cancelled' in UI, not an error\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use a dedicated Cancelled error variant instead of string matching","Only return false from progress_callback on explicit user cancellation","Report partial segment counts when cancelled"],"tags":["vad","cancellation","progress","retranscription"],"backgroundTag":"operation-cancelled-by-callback","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}