Zackriya-Solutions/meetily · error
VAD task panicked: {}
Error message
VAD task panicked: {} What it means
The blocking task running `get_speech_chunks_with_progress` (VAD speech segmentation) panicked, so the JoinError branch fired instead of the function's own Result (which is the separate 'VAD processing failed' error on the next line). Note the callback shown returns `!IMPORT_CANCELLED` — cancellation makes VAD return early with a normal value, so this error specifically indicates a panic, not cancellation.
Source
Thrown at frontend/src-tauri/src/audio/import.rs:453
&audio_samples,
VAD_REDEMPTION_TIME_MS,
|vad_progress, segments_found| {
let overall_progress = 25 + (vad_progress as f32 * 0.05) as u32;
emit_progress(
&app_for_vad,
"vad",
overall_progress,
&format!(
"Detecting speech segments... {}% ({} found)",
vad_progress, segments_found
),
);
!IMPORT_CANCELLED.load(Ordering::SeqCst)
},
)
})
.await
.map_err(|e| anyhow!("VAD task panicked: {}", e))?
.map_err(|e| anyhow!("VAD processing failed: {}", e))?;
let total_segments = speech_segments.len();
info!("VAD detected {} speech segments (redemption_time={}ms)", total_segments, VAD_REDEMPTION_TIME_MS);
// Diagnostic: log segment duration distribution
if !speech_segments.is_empty() {
let durations_ms: Vec<f64> = speech_segments.iter()
.map(|s| s.end_timestamp_ms - s.start_timestamp_ms)
.collect();
let total_speech_ms: f64 = durations_ms.iter().sum();
let avg_duration = total_speech_ms / durations_ms.len() as f64;
let min_duration = durations_ms.iter().cloned().fold(f64::INFINITY, f64::min);
let max_duration = durations_ms.iter().cloned().fold(f64::NEG_INFINITY, f64::max);
info!(
"VAD segment stats: avg={:.0}ms, min={:.0}ms, max={:.0}ms, total_speech={:.1}s/{:.1}s ({:.0}%)",
avg_duration, min_duration, max_duration,
total_speech_ms / 1000.0, duration_seconds,View on GitHub (pinned to 0281737d87)
Solutions
- Run with RUST_BACKTRACE=1 and use try_into_panic() — the frame points into vad.rs (window slicing or model unwrap)
- Log audio_samples.len() before VAD and reject files with too little audio (e.g. under 1 second) earlier in the pipeline
- Verify VAD model assets exist and load; re-download if the models dir was cleaned
- Reject non-finite samples after resample: `if audio_samples.iter().any(|s| !s.is_finite())`
Example fix
// before
let speech_segments = tokio::task::spawn_blocking(move || {
get_speech_chunks_with_progress(&audio_samples, VAD_REDEMPTION_TIME_MS, /*progress cb*/)
}).await.map_err(|e| anyhow!("VAD task panicked: {}", e))?
.map_err(|e| anyhow!("VAD processing failed: {}", e))?;
// after — pre-validate samples so panics never reach VAD
if audio_samples.len() < 16_000 {
let _ = std::fs::remove_dir_all(&meeting_folder);
return Err(anyhow!("Audio shorter than 1s — nothing for VAD to segment"));
}
if audio_samples.iter().any(|s| !s.is_finite()) {
let _ = std::fs::remove_dir_all(&meeting_folder);
return Err(anyhow!("Resampled audio contains non-finite samples"));
} Defensive patterns
Strategy: validation
Validate before calling
// reject inputs that panic VAD
if audio_samples.len() < 16_000 {
return Err(anyhow!("Audio shorter than 1s — nothing for VAD to segment"));
}
if audio_samples.iter().any(|s| !s.is_finite()) {
return Err(anyhow!("Resampled audio contains non-finite samples"));
} Try / catch
Distinguish the two VAD failures explicitly: JoinError ('VAD task panicked') means a bug — capture try_into_panic() with RUST_BACKTRACE=1; the second map_err ('VAD processing failed') is a normal VAD error worth retrying with different audio. Prevention
- Reject sub-second clips before the VAD stage
- Verify VAD model assets exist after app updates that touch the models dir
- Sanitize resampler output for non-finite samples before feeding VAD
When it happens
Trigger: A panic inside VAD: window slicing out of bounds when the audio is shorter than one analysis window, NaN/inf samples fed to the model after a marginal decode/resample, or an unwrap on a missing/unloaded VAD model resource.
Common situations: Importing clips shorter than a second, silence-only files after resample glitches, or a models directory missing the VAD (onnx) resource after an app update or manual cleanup.
Related errors
- Decode task join error: {}
- Resample task join error: {}
- VAD task panicked: {}
- Copy task join error: {}
- Decode task panicked: {}
AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16).
Data as JSON: /api/errors/2be15dd892a139d3.
Report an issue: GitHub.