{"record":{"id":"cc11f17c1eeb0047","repo":"Zackriya-Solutions/meetily","slug":"whisper-transcription-failed-on-segment","errorCode":null,"errorMessage":"Whisper transcription failed on segment {}: {}","messagePattern":"Whisper transcription failed on segment (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src-tauri/src/audio/import.rs","lineNumber":594,"sourceCode":"                segment.samples.len()\n            );\n            continue;\n        }\n\n        // Transcribe\n        let (text, conf) = if use_parakeet {\n            let engine = parakeet_engine.as_ref().unwrap();\n            let text = engine\n                .transcribe_audio(segment.samples.clone())\n                .await\n                .map_err(|e| anyhow!(\"Parakeet transcription failed on segment {}: {}\", i, e))?;\n            (text, 0.9f32)\n        } else {\n            let engine = whisper_engine.as_ref().unwrap();\n            let (text, conf, _) = engine\n                .transcribe_audio_with_confidence(segment.samples.clone(), language.clone())\n                .await\n                .map_err(|e| anyhow!(\"Whisper transcription failed on segment {}: {}\", i, e))?;\n            (text, conf)\n        };\n\n        let trimmed = text.trim();\n        if !trimmed.is_empty() {\n            debug!(\n                \"Segment {}/{}: {:.1}s, conf={:.2}, text='{}'\",\n                i + 1, processable_count, segment_duration_sec, conf,\n                if trimmed.len() > 80 { let mut end = 80; while !trimmed.is_char_boundary(end) { end -= 1; } &trimmed[..end] } else { trimmed }\n            );\n            all_transcripts.push((text, segment.start_timestamp_ms, segment.end_timestamp_ms));\n            total_confidence += conf;\n        } else {\n            debug!(\"Segment {}/{}: {:.1}s — empty transcription\", i + 1, processable_count, segment_duration_sec);\n        }\n    }\n\n    let transcribed_count = all_transcripts.len();","sourceCodeStart":576,"sourceCodeEnd":612,"githubUrl":"https://github.com/Zackriya-Solutions/meetily/blob/0281737d87d26352fb0adc78c8c0975f691b23d1/frontend/src-tauri/src/audio/import.rs#L576-L612","documentation":"`WhisperEngine::transcribe_audio_with_confidence(samples, language)` returned Err for segment i; the whisper-rs error is chained after the colon. As with the parakeet branch, `?` aborts the whole import on one failing segment. Distinct from the model-load error in get_or_init_whisper: the model is already loaded here — this is an inference-time failure.","triggerScenarios":"Default whisper path with >0 segments: an invalid `language` string (whisper-rs expects ISO codes like 'en', not 'english'), the model being unloaded/invalidated concurrently while the loop runs, a GPU (Metal/CUDA/Vulkan) context lost after sleep/wake, or corrupt/empty sample slices after VAD splitting.","commonSituations":"A language selector sending full language names; user changes or unloads the whisper model in settings during a long import; laptop sleep/resume mid-import; edge-case segments near the 1600-sample skip threshold.","solutions":["Normalize the language argument to an ISO-639-1 code (map 'english' to 'en') or pass None before invoking the import command","Inspect the inner whisper-rs error text after the colon — it distinguishes invalid-parameter errors from GPU/backend errors","Retry the failed segment once (transient Metal/CUDA faults often pass) before aborting the import","If GPU errors repeat, test with a CPU-feature build to confirm, then fix the GPU runtime"],"exampleFix":"// before — any segment failure aborts the import\nlet (text, conf, _) = engine\n    .transcribe_audio_with_confidence(segment.samples.clone(), language.clone())\n    .await\n    .map_err(|e| anyhow!(\"Whisper transcription failed on segment {}: {}\", i, e))?;\n\n// after — validate language once, then tolerate per-segment failure\nlet lang = language.as_deref().map(normalize_lang_code); // 'english' -> 'en'\nlet (text, conf, _) = match engine\n    .transcribe_audio_with_confidence(segment.samples.clone(), lang)\n    .await\n{\n    Ok(r) => r,\n    Err(e) => {\n        warn!(\"Whisper failed on segment {}, skipping: {}\", i, e);\n        continue;\n    }\n};","handlingStrategy":"retry","validationCode":"// validate the language argument before invoking import\nconst WHISPER_LANGS = new Set(['en', 'es', 'fr', 'de', /* ... */]);\nconst lang = language && WHISPER_LANGS.has(language.toLowerCase()) ? language : null;\nawait invoke('start_import', { sourcePath, title, language: lang });","typeGuard":null,"tryCatchPattern":"Retry once with the same segment (transient GPU faults pass), then skip the segment and continue the loop; abort the import only when consecutive segments fail — surfacing the inner whisper-rs error text is what makes the retry decision possible.","preventionTips":["Always pass ISO-639-1 codes ('en'), never full names ('english'), to language","Confirm get_current_model() is Some before entering the segment loop","Avoid model changes or explicit unload commands while an import runs","On laptops, treat sleep/wake during import as a retry-worthy event"],"tags":["whisper","whisper-rs","transcription","stt","language-code","rust"],"backgroundTag":"stt-transcription-failure","analyzedSha":"0281737d87d26352fb0adc78c8c0975f691b23d1","analyzedAt":"2026-08-16T20:57:52.567Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}