{"record":{"id":"394a25e888969a79","repo":"mudler/LocalAI","slug":"omnivoice-cpp-error-synthesize-failed-rc-d","errorCode":null,"errorMessage":"[omnivoice-cpp] ERROR: synthesize failed (rc=%d): %s\\n","messagePattern":"\\[omnivoice-cpp\\] ERROR: synthesize failed \\(rc=(.+?)\\): (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/go/omnivoice-cpp/cpp/gomnivoicecpp.cpp","lineNumber":102,"sourceCode":"                long long seed, int denoise, int *out_n) {\n    if (out_n)\n        *out_n = 0;\n    if (!g_ctx) {\n        fprintf(stderr, \"[omnivoice-cpp] ERROR: model not loaded\\n\");\n        return nullptr;\n    }\n    if (!text || text[0] == '\\0') {\n        fprintf(stderr, \"[omnivoice-cpp] ERROR: text is required\\n\");\n        return nullptr; // omni_tts: out_n already 0\n    }\n    ov_tts_params tp;\n    fill_params(&tp, text, lang, instruct, ref_samples, ref_n, ref_text, seed,\n                denoise);\n\n    ov_audio out = {0};\n    enum ov_status rc = ov_synthesize(g_ctx, &tp, &out);\n    if (rc != OV_STATUS_OK || out.n_samples <= 0 || !out.samples) {\n        fprintf(stderr, \"[omnivoice-cpp] ERROR: synthesize failed (rc=%d): %s\\n\",\n                (int)rc, ov_last_error());\n        ov_audio_free(&out);\n        return nullptr;\n    }\n\n    // Copy into a plain malloc buffer the Go side can free symmetrically via\n    // omni_pcm_free; then release the ov_audio-owned buffer.\n    size_t bytes = (size_t)out.n_samples * sizeof(float);\n    float *buf = (float *)malloc(bytes);\n    if (!buf) {\n        fprintf(stderr, \"[omnivoice-cpp] ERROR: malloc(%zu) failed\\n\", bytes);\n        ov_audio_free(&out);\n        return nullptr;\n    }\n    memcpy(buf, out.samples, bytes);\n    if (out_n)\n        *out_n = out.n_samples;\n    ov_audio_free(&out);","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/omnivoice-cpp/cpp/gomnivoicecpp.cpp#L84-L120","documentation":"ov_synthesize returned a non-zero status. Guard: check model-loaded state and input length limits before synthesis; on failure, propagate the rc and error string to the gRPC response instead of crashing, and log the failing text length.","triggerScenarios":"Thrown at backend/go/omnivoice-cpp/cpp/gomnivoicecpp.cpp:102 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the rc code and the detail message to identify the underlying synthesize failure.","Verify the model and codec files are valid and compatible with the omnivoice library version.","Check available memory and logs for OOM or decoder errors during synthesis."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}