mudler/LocalAI · error
[omnivoice-cpp] ERROR: model not loaded\n
Error message
[omnivoice-cpp] ERROR: model not loaded\n
What it means
omni_tts() was called while g_ctx is NULL — no model loaded (omni_load never succeeded or never called). The shim zeroes *out_n first and returns nullptr; a later comment in the file confirms out_n stays 0. Lifecycle/ordering error identical in shape to moss-tts error 172.
Source
Thrown at backend/go/omnivoice-cpp/cpp/gomnivoicecpp.cpp:88
tp->instruct = instruct;
if (ref_samples && ref_n > 0) {
tp->ref_audio_24k = ref_samples;
tp->ref_n_samples = ref_n;
if (ref_text && ref_text[0] != '\0')
tp->ref_text = ref_text;
tp->denoise = denoise != 0;
}
if (seed >= 0)
tp->mg_seed = (uint64_t)seed;
}
float *omni_tts(const char *text, const char *lang, const char *instruct,
const float *ref_samples, int ref_n, const char *ref_text,
long long seed, int denoise, int *out_n) {
if (out_n)
*out_n = 0;
if (!g_ctx) {
fprintf(stderr, "[omnivoice-cpp] ERROR: model not loaded\n");
return nullptr;
}
if (!text || text[0] == '\0') {
fprintf(stderr, "[omnivoice-cpp] ERROR: text is required\n");
return nullptr; // omni_tts: out_n already 0
}
ov_tts_params tp;
fill_params(&tp, text, lang, instruct, ref_samples, ref_n, ref_text, seed,
denoise);
ov_audio out = {0};
enum ov_status rc = ov_synthesize(g_ctx, &tp, &out);
if (rc != OV_STATUS_OK || out.n_samples <= 0 || !out.samples) {
fprintf(stderr, "[omnivoice-cpp] ERROR: synthesize failed (rc=%d): %s\n",
(int)rc, ov_last_error());
ov_audio_free(&out);
return nullptr;
}View on GitHub (pinned to 44413a9d06)
Solutions
- Gate the TTS endpoint on omni_load returning 0.
- On load failure, fail backend startup loudly instead of continuing to serve.
Example fix
// before
C.omni_load(m, c, 0, 0)
audio := C.omni_tts(...)
// after
if rc := C.omni_load(m, c, 0, 0); rc != 0 {
return fmt.Errorf("omnivoice-cpp load failed: %d", rc)
}
audio := C.omni_tts(...) Defensive patterns
Strategy: validation
Validate before calling
mu.Lock(); loaded := gCtxOK; mu.Unlock()
if !loaded {
return nil, errors.New("omnivoice-cpp: model not loaded; call omni_load first")
} Prevention
- Gate omni_tts on omni_load returning 0.
- Check out_n == 0 && ptr == nil as the not-loaded / failed signature and return a clear error.
When it happens
Trigger: Calling omni_tts before a successful omni_load, or after omni_load returned 1/2/3 (errors 176-178) and the return code was ignored.
Common situations: Serving requests before the model finishes loading; load failure swallowed by the caller; backend restart raced with an in-flight request.
Related errors
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/08ff993856e9aca5.
Report an issue: GitHub.