{"record":{"id":"ba6f8713bfe0f344","repo":"Zackriya-Solutions/meetily","slug":"parakeet-transcription-failed","errorCode":null,"errorMessage":"Parakeet transcription failed: {}","messagePattern":"Parakeet transcription failed: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs","lineNumber":470,"sourceCode":"\n    /// Transcribe audio samples using the loaded Parakeet model\n    pub async fn transcribe_audio(&self, audio_data: Vec<f32>) -> Result<String> {\n        let mut model_guard = self.current_model.write().await;\n        let model = model_guard\n            .as_mut()\n            .ok_or_else(|| anyhow!(\"No Parakeet model loaded. Please load a model first.\"))?;\n\n        let duration_seconds = audio_data.len() as f64 / 16000.0; // Assuming 16kHz\n        log::debug!(\n            \"Parakeet transcribing {} samples ({:.1}s duration)\",\n            audio_data.len(),\n            duration_seconds\n        );\n\n        // Transcribe using Parakeet model\n        let result = model\n            .transcribe_samples(audio_data)\n            .map_err(|e| anyhow!(\"Parakeet transcription failed: {}\", e))?;\n\n        log::debug!(\"Parakeet transcription result: '{}'\", result.text);\n\n        Ok(result.text)\n    }\n\n    /// Get the models directory path\n    pub async fn get_models_directory(&self) -> PathBuf {\n        self.models_dir.clone()\n    }\n\n    /// Delete a corrupted model\n    pub async fn delete_model(&self, model_name: &str) -> Result<String> {\n        log::info!(\"Attempting to delete Parakeet model: {}\", model_name);\n\n        // Get model info to find the directory path\n        let model_info = {\n            let models = self.available_models.read().await;","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs#L452-L488","documentation":"Returned by transcribe_audio when ParakeetModel::transcribe_samples returns an error. transcribe_samples packs samples into an ndarray [1, N], runs the nemo128 preprocessor and encoder/decoder_joint ONNX sessions, and decodes greedily against vocab.txt, so failures include ndarray shape errors (e.g. empty sample vector), ONNX Runtime inference errors (bad tensor shape, provider failure), and decode/vocabulary errors.","triggerScenarios":"Passing an empty Vec<f32> (Array2::from_shape_vec((1, 0)) fails); passing audio that is not 16 kHz mono float PCM (the code assumes 16000.0 Hz); a NaN/inf-laden buffer from a broken capture resampler; an ONNX session failing mid-inference after the model was corrupted in memory or memory pressure killed the run.","commonSituations":"VAD passed a zero-length speech segment through to transcription; audio pipeline resampling bug produced garbage samples; extremely long unsegmented audio exhausting memory during preprocessing; model files modified on disk after session creation in another process.","solutions":["Guard against empty/near-empty audio_data before calling transcribe_audio (skip segments under a few hundred samples)","Confirm the caller delivers 16 kHz mono f32 samples (pipeline resamples to 16k; verify no 48 kHz buffer leaks through)","Sanitize samples (replace non-finite values, clamp) before transcription","Reproduce with RUST_LOG=app_lib::parakeet_engine=debug - the log line 'Parakeet transcribing N samples' shows whether N is sane when the failure happens"],"exampleFix":"// before\nlet text = engine.transcribe_audio(chunk.samples).await?;\n\n// after - drop empty/too-short segments before inference\nif chunk.samples.len() < 400 { // ~25ms at 16kHz, nothing to transcribe\n    continue;\n}\nlet text = engine.transcribe_audio(chunk.samples).await?;","handlingStrategy":"validation","validationCode":"// Filter unusable audio before inference\nconst MIN_SAMPLES: usize = 400; // ~25 ms at 16 kHz\nif samples.len() < MIN_SAMPLES { return Ok(String::new()); }\nif samples.iter().any(|s| !s.is_finite()) {\n    samples.retain(|s| s.is_finite()); // or bail: bad capture pipeline\n}\n// ensure the buffer is 16 kHz mono f32 - resample upstream if not","typeGuard":null,"tryCatchPattern":"match engine.transcribe_audio(samples).await {\n    Ok(text) => Some(text),\n    Err(e) if e.to_string().contains(\"Parakeet transcription failed\") => {\n        log::warn!(\"parakeet inference failed ({e}); dropping this segment\");\n        None // do not kill the recording loop for one bad segment\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Skip empty and sub-25ms VAD segments instead of forwarding them to Parakeet","Guarantee 16 kHz mono float PCM at the boundary - the engine hardcodes 16000.0 Hz","Sanitize NaN/inf from the capture/resample path before buffering","Log sample count on failure ('Parakeet transcribing N samples') to catch shape bugs fast"],"tags":["parakeet","inference","onnx-runtime","audio","validation"],"backgroundTag":"inference-failed","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}