Zackriya-Solutions/meetily · error · anyhow::Error
Parakeet transcription failed: {}
Error message
Parakeet transcription failed: {} What it means
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.
Source
Thrown at frontend/src-tauri/src/parakeet_engine/parakeet_engine.rs:470
/// Transcribe audio samples using the loaded Parakeet model
pub async fn transcribe_audio(&self, audio_data: Vec<f32>) -> Result<String> {
let mut model_guard = self.current_model.write().await;
let model = model_guard
.as_mut()
.ok_or_else(|| anyhow!("No Parakeet model loaded. Please load a model first."))?;
let duration_seconds = audio_data.len() as f64 / 16000.0; // Assuming 16kHz
log::debug!(
"Parakeet transcribing {} samples ({:.1}s duration)",
audio_data.len(),
duration_seconds
);
// Transcribe using Parakeet model
let result = model
.transcribe_samples(audio_data)
.map_err(|e| anyhow!("Parakeet transcription failed: {}", e))?;
log::debug!("Parakeet transcription result: '{}'", result.text);
Ok(result.text)
}
/// Get the models directory path
pub async fn get_models_directory(&self) -> PathBuf {
self.models_dir.clone()
}
/// Delete a corrupted model
pub async fn delete_model(&self, model_name: &str) -> Result<String> {
log::info!("Attempting to delete Parakeet model: {}", model_name);
// Get model info to find the directory path
let model_info = {
let models = self.available_models.read().await;View on GitHub (pinned to 0281737d87)
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
Example fix
// before
let text = engine.transcribe_audio(chunk.samples).await?;
// after - drop empty/too-short segments before inference
if chunk.samples.len() < 400 { // ~25ms at 16kHz, nothing to transcribe
continue;
}
let text = engine.transcribe_audio(chunk.samples).await?; Defensive patterns
Strategy: validation
Validate before calling
// Filter unusable audio before inference
const MIN_SAMPLES: usize = 400; // ~25 ms at 16 kHz
if samples.len() < MIN_SAMPLES { return Ok(String::new()); }
if samples.iter().any(|s| !s.is_finite()) {
samples.retain(|s| s.is_finite()); // or bail: bad capture pipeline
}
// ensure the buffer is 16 kHz mono f32 - resample upstream if not Try / catch
match engine.transcribe_audio(samples).await {
Ok(text) => Some(text),
Err(e) if e.to_string().contains("Parakeet transcription failed") => {
log::warn!("parakeet inference failed ({e}); dropping this segment");
None // do not kill the recording loop for one bad segment
}
Err(e) => return Err(e),
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Device name cannot be empty
- Device type (input/output) not specified in the name
- Parakeet transcription failed on segment {}: {}
- Failed to load Parakeet model {}: {}
- Parakeet model '{}' not found
AI-assisted analysis of Zackriya-Solutions/meetily@0281737d87 (2026-08-16).
Data as JSON: /api/errors/ba6f8713bfe0f344.
Report an issue: GitHub.