{"record":{"id":"ce868aafce94bc3d","repo":"Zackriya-Solutions/meetily","slug":"vad-processing-failed","errorCode":null,"errorMessage":"VAD processing failed: {}","messagePattern":"VAD processing failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/vad.rs","lineNumber":222,"sourceCode":"        // Extract all remaining segments\n        while let Some(segment) = self.speech_segments.pop_front() {\n            completed_segments.push(segment);\n        }\n\n        Ok(completed_segments)\n    }\n\n    fn process_chunk(&mut self, chunk: &[f32]) -> Result<()> {\n        // Track accumulated speech buffer size to detect memory issues\n        let current_speech_size = self.current_speech.len();\n        if current_speech_size > 1_000_000 {\n            // More than ~62 seconds of accumulated speech at 16kHz\n            warn!(\"VAD: Accumulated speech buffer is large: {} samples ({:.1}s) - possible memory issue\",\n                  current_speech_size, current_speech_size as f64 / 16000.0);\n        }\n\n        let transitions = self.session.process(chunk)\n            .map_err(|e| anyhow!(\"VAD processing failed: {}\", e))?;\n\n        // Log transitions for debugging\n        if !transitions.is_empty() {\n            debug!(\"VAD transitions at sample {}: {} transitions\", self.processed_samples, transitions.len());\n        }\n\n        // Handle VAD transitions\n        for transition in transitions {\n            match transition {\n                VadTransition::SpeechStart { timestamp_ms } => {\n                    // Only log if state changed\n                    if !self.last_logged_state {\n                        debug!(\"VAD: Speech started at {}ms\", timestamp_ms);\n                        self.last_logged_state = true;\n                    }\n                    self.in_speech = true;\n                    // Use 16000 (VAD processing rate) since processed_samples counts 16kHz samples\n                    self.speech_start_sample = self.processed_samples + (timestamp_ms * 16000 / 1000);","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/vad.rs#L204-L240","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm chunks passed to process_chunk are the processor's chunk_size (480 samples @ 16k) windows","Sanitize input: replace non-finite samples with 0.0 before process","Log the underlying error text (currently hidden behind the generic message) to identify ONNX runtime errors","Update VAD/onnxruntime dependencies if the inner error is a runtime bug"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Sanitize samples before feeding VAD inference\nfn finite_or_zero(samples: &mut [f32]) {\n    for s in samples.iter_mut() {\n        if !s.is_finite() { *s = 0.0; }\n    }\n}","typeGuard":null,"tryCatchPattern":"match self.session.process(chunk) {\n    Ok(transitions) => { /* handle transitions */ }\n    Err(e) => {\n        warn!(\"VAD chunk failed ({} samples), skipping window: {e}\", chunk.len());\n        // skip this window; keep the recording loop alive\n    }\n}","preventionTips":["Accumulate into the buffer and feed exactly chunk_size (480-sample) windows","Zero out non-finite samples after resampling","Include the inner error text when wrapping this message"],"tags":["vad","silero","inference","audio-pipeline"],"backgroundTag":"vad-inference-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}