mudler/LocalAI · error

[qwen3-tts-cpp] ERROR: synthesize failed

Error message

[qwen3-tts-cpp] ERROR: synthesize failed (rc=%d): %s\n

What it means

qt_synthesize returned a non-zero status. Guard: check model-loaded state and input length limits before synthesis; propagate the rc and error string to the gRPC response instead of crashing.

Solutions

  1. Inspect the rc code and detail message for the root cause of the synthesize failure.
  2. Verify model/codec compatibility and available memory.
  3. Retry with shorter text to rule out length-related failures.

When it happens

Trigger: Thrown at backend/go/qwen3-tts-cpp/cpp/goqwen3ttscpp.cpp:120 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/3fa6bb3d8a7681e5. Report an issue: GitHub.

Appendix: source

Thrown at backend/go/qwen3-tts-cpp/cpp/goqwen3ttscpp.cpp:120

    if (out_n)
        *out_n = 0;
    if (!g_ctx) {
        fprintf(stderr, "[qwen3-tts-cpp] ERROR: model not loaded\n");
        return nullptr;
    }
    if (!text || text[0] == '\0') {
        fprintf(stderr, "[qwen3-tts-cpp] ERROR: text is required\n");
        return nullptr;
    }
    qt_tts_params tp;
    fill_params(&tp, text, lang, instruct, speaker, ref_samples, ref_n,
                ref_text, seed, temperature, top_k, top_p, repetition_penalty,
                max_new_tokens);

    qt_audio out = {0};
    enum qt_status rc = qt_synthesize(g_ctx, &tp, &out);
    if (rc != QT_STATUS_OK || out.n_samples <= 0 || !out.samples) {
        fprintf(stderr, "[qwen3-tts-cpp] ERROR: synthesize failed (rc=%d): %s\n",
                (int)rc, qt_last_error());
        qt_audio_free(&out);
        return nullptr;
    }

    // Copy into a plain malloc buffer the Go side frees via qt3_pcm_free.
    size_t bytes = (size_t)out.n_samples * sizeof(float);
    float *buf = (float *)malloc(bytes);
    if (!buf) {
        fprintf(stderr, "[qwen3-tts-cpp] ERROR: malloc(%zu) failed\n", bytes);
        qt_audio_free(&out);
        return nullptr;
    }
    memcpy(buf, out.samples, bytes);
    if (out_n)
        *out_n = out.n_samples;
    qt_audio_free(&out);
    return buf;

View on GitHub (pinned to 44413a9d06)