mudler/LocalAI · error
error: transcription failed\n
Error message
error: transcription failed\n
What it means
transcribe() failed: crispasr_session_transcribe_lang() returned NULL after the session accepted parameters (translate flag, freed previous result). A NULL result means the transcription run itself errored — decode failure, invalid language string, or an internal session state problem. The shim returns 1 and leaves g_result NULL.
Source
Thrown at backend/go/crispasr/cpp/crispasr_shim.cpp:262
}
// Reset stale abort flag from any prior cancelled call. set_abort remains
// best-effort: the session transcribe call is blocking and exposes no abort
// hook, so a mid-decode abort cannot interrupt it.
g_abort.store(0, std::memory_order_relaxed);
crispasr_session_set_translate(g_session, translate ? 1 : 0);
if (g_result) {
crispasr_session_result_free(g_result);
g_result = nullptr;
}
const char *language = (lang && *lang) ? lang : nullptr;
g_result = crispasr_session_transcribe_lang(g_session, pcmf32, (int)pcmf32_len,
language);
if (!g_result) {
fprintf(stderr, "error: transcription failed\n");
return 1;
}
*segs_out_len = crispasr_session_result_n_segments(g_result);
return 0;
}
const char *get_segment_text(int i) {
if (!g_result) {
return "";
}
return crispasr_session_result_segment_text(g_result, i);
}
int64_t get_segment_t0(int i) {
if (!g_result) {
return 0;
}View on GitHub (pinned to 44413a9d06)
Solutions
- Pass a known language code (e.g., "en") or NULL for auto-detect — never an unrecognized string.
- Check pcmf32_len > 0 and the PCM is valid 16 kHz float mono as whisper expects.
- Inspect ggml logs immediately before the error for the decoding failure reason.
- If the session is suspect, reload the model (load_model) to get a fresh session.
Example fix
// before: empty string is not auto-detect
transcribe(pcm, n, "", 0);
// after: NULL selects auto-detection in the shim
code := (*C.char)(unsafe.Pointer(nil));
if lang != "" { code = C.CString(lang); defer C.free(unsafe.Pointer(code)) }
transcribe(pcm, n, code, 0); Defensive patterns
Strategy: validation
Validate before calling
if len(pcm) == 0 { return nil, errors.New("empty audio") }
if lang != "" && !knownLanguages()[lang] { lang = "" } // fall back to auto-detect Prevention
- Pass NULL (not empty string) for auto language detection.
- Check the result pointer for NULL and report a transcription error rather than reading segments.
- Reload the session if transcribe fails repeatedly — state may be corrupted.
When it happens
Trigger: transcribe(pcm, len, lang, translate) with an unsupported lang code, pcm length of zero or exceeding the session's limit, corrupted session state after a prior failed run, or backend compute errors during decoding.
Common situations: Passing an empty-string or invalid language identifier instead of NULL; feeding an audio buffer that is empty because upstream resampling failed; GPU backend faults mid-decode; repeatedly reusing a session after an OOM event.
Related errors
- error: failed to open CrispASR session for model\n
- Web Audio API not available
- error: Failed to init model as VAD\n
- error: failed to detect speech\n
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/cf96f9a23c6813b3.
Report an issue: GitHub.