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

VAD processing failed: {}

Error message

VAD processing failed: {}

What it means

session.process(chunk) returned an error inside process_chunk - the silero VAD failed to run inference on the given samples. Since session creation succeeded, this points at chunk contents/shape or an ONNX runtime error mid-stream rather than configuration.

Source

Thrown at frontend/src-tauri/src/audio/vad.rs:222

        // Extract all remaining segments
        while let Some(segment) = self.speech_segments.pop_front() {
            completed_segments.push(segment);
        }

        Ok(completed_segments)
    }

    fn process_chunk(&mut self, chunk: &[f32]) -> Result<()> {
        // Track accumulated speech buffer size to detect memory issues
        let current_speech_size = self.current_speech.len();
        if current_speech_size > 1_000_000 {
            // More than ~62 seconds of accumulated speech at 16kHz
            warn!("VAD: Accumulated speech buffer is large: {} samples ({:.1}s) - possible memory issue",
                  current_speech_size, current_speech_size as f64 / 16000.0);
        }

        let transitions = self.session.process(chunk)
            .map_err(|e| anyhow!("VAD processing failed: {}", e))?;

        // Log transitions for debugging
        if !transitions.is_empty() {
            debug!("VAD transitions at sample {}: {} transitions", self.processed_samples, transitions.len());
        }

        // Handle VAD transitions
        for transition in transitions {
            match transition {
                VadTransition::SpeechStart { timestamp_ms } => {
                    // Only log if state changed
                    if !self.last_logged_state {
                        debug!("VAD: Speech started at {}ms", timestamp_ms);
                        self.last_logged_state = true;
                    }
                    self.in_speech = true;
                    // Use 16000 (VAD processing rate) since processed_samples counts 16kHz samples
                    self.speech_start_sample = self.processed_samples + (timestamp_ms * 16000 / 1000);

View on GitHub (pinned to 0281737d87)

Solutions

  1. Confirm chunks passed to process_chunk are the processor's chunk_size (480 samples @ 16k) windows
  2. Sanitize input: replace non-finite samples with 0.0 before process
  3. Log the underlying error text (currently hidden behind the generic message) to identify ONNX runtime errors
  4. Update VAD/onnxruntime dependencies if the inner error is a runtime bug
Defensive patterns

Strategy: try-catch

Validate before calling

// Sanitize samples before feeding VAD inference
fn finite_or_zero(samples: &mut [f32]) {
    for s in samples.iter_mut() {
        if !s.is_finite() { *s = 0.0; }
    }
}

Try / catch

match self.session.process(chunk) {
    Ok(transitions) => { /* handle transitions */ }
    Err(e) => {
        warn!("VAD chunk failed ({} samples), skipping window: {e}", chunk.len());
        // skip this window; keep the recording loop alive
    }
}

Prevention

When it happens

Trigger: Feeding chunks whose length does not match the 480-sample (30 ms @ 16 kHz) windows the processor is built around, buffers containing NaN/Inf samples (bad resample or divide), or transient ONNX runtime failures under memory pressure.

Common situations: Resampler producing non-finite samples after a device glitch; a code path feeding variable-size chunks directly to process_chunk; long meetings under heavy system load.

Related errors


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