{"record":{"id":"7729b907b5b22820","repo":"mudler/LocalAI","slug":"omnivoice-cpp-error-text-is-required-n","errorCode":null,"errorMessage":"[omnivoice-cpp] ERROR: text is required\\n","messagePattern":"\\[omnivoice-cpp\\] ERROR: text is required\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/go/omnivoice-cpp/cpp/gomnivoicecpp.cpp","lineNumber":92,"sourceCode":"        if (ref_text && ref_text[0] != '\\0')\n            tp->ref_text = ref_text;\n        tp->denoise = denoise != 0;\n    }\n    if (seed >= 0)\n        tp->mg_seed = (uint64_t)seed;\n}\n\nfloat *omni_tts(const char *text, const char *lang, const char *instruct,\n                const float *ref_samples, int ref_n, const char *ref_text,\n                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);","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/omnivoice-cpp/cpp/gomnivoicecpp.cpp#L74-L110","documentation":"The omnivoice-cpp backend received a synthesis request with an empty text field. Guard: validate the request text is non-empty before calling into the shim; trim whitespace and reject empty payloads at the gRPC handler so the C++ layer never sees them.","triggerScenarios":"Thrown at backend/go/omnivoice-cpp/cpp/gomnivoicecpp.cpp:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty text field in the TTS request.","Check the client code path to ensure the text parameter is set before calling the synthesize endpoint."],"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-15T17:31:12.345Z"}