mudler/LocalAI · error

[moss-tts-cpp] ERROR: local_path is required\n

Error message

[moss-tts-cpp] ERROR: local_path is required\n

What it means

mtl_load() rejects the call because local_path is NULL or an empty string (return 1). This is pure argument validation before any model work: the Moss TTS main model file argument is mandatory. No ggml loading has happened yet at this point.

Source

Thrown at backend/go/moss-tts-cpp/cpp/mossttscpp.cpp:35

    const char *lvl = "?????";
    switch (level) {
    case GGML_LOG_LEVEL_DEBUG: lvl = "DEBUG"; break;
    case GGML_LOG_LEVEL_INFO:  lvl = "INFO";  break;
    case GGML_LOG_LEVEL_WARN:  lvl = "WARN";  break;
    case GGML_LOG_LEVEL_ERROR: lvl = "ERROR"; break;
    default: break;
    }
    fprintf(stderr, "[%-5s] %s", lvl, log);
    fflush(stderr);
}

int mtl_load(const char *local_path, const char *codec_path,
             const char *tokenizer_path) {
    ggml_log_set(ggml_log_cb, nullptr);
    ggml_backend_load_all();

    if (!local_path || local_path[0] == '\0') {
        fprintf(stderr, "[moss-tts-cpp] ERROR: local_path is required\n");
        return 1;
    }
    if (!codec_path || codec_path[0] == '\0') {
        fprintf(stderr, "[moss-tts-cpp] ERROR: codec_path is required\n");
        return 2;
    }
    if (!tokenizer_path || tokenizer_path[0] == '\0') {
        fprintf(stderr, "[moss-tts-cpp] ERROR: tokenizer_path is required\n");
        return 3;
    }

    fprintf(stderr,
            "[moss-tts-cpp] Loading local=%s codec=%s tokenizer=%s\n",
            local_path, codec_path, tokenizer_path);

    g_local = moss_local_load(local_path, codec_path, tokenizer_path);
    if (!g_local) {
        fprintf(stderr, "[moss-tts-cpp] FATAL: moss_local_load failed\n");

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Set a valid local_path (the Moss TTS main model file) in the backend configuration before loading.
  2. On the Go side, guard empty strings before invoking the C shim.

Example fix

// before
rc := C.mtl_load(C.CString(""), codec, tok);
// after
if modelPath == "" { return errors.New("moss-tts-cpp: model path required") }
rc := C.mtl_load(C.CString(modelPath), codec, tok);
Defensive patterns

Strategy: validation

Validate before calling

if strings.TrimSpace(modelPath) == "" {
    return errors.New("moss-tts-cpp: local_path is required")
}

Prevention

When it happens

Trigger: Calling mtl_load("", codec, tokenizer), or passing a nil pointer from Go (e.g., an unset model path in backend config resolves to empty string before the purego/cgo call).

Common situations: LocalAI backend config missing the model file entry; path template left unexpanded; caller passes an empty option struct by mistake.

Related errors


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