{"record":{"id":"603a9bb48dcc02c5","repo":"mudler/LocalAI","slug":"moss-tts-cpp-error-local-path-is-required-n","errorCode":null,"errorMessage":"[moss-tts-cpp] ERROR: local_path is required\\n","messagePattern":"\\[moss-tts-cpp\\] ERROR: local_path is required\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/go/moss-tts-cpp/cpp/mossttscpp.cpp","lineNumber":35,"sourceCode":"    const char *lvl = \"?????\";\n    switch (level) {\n    case GGML_LOG_LEVEL_DEBUG: lvl = \"DEBUG\"; break;\n    case GGML_LOG_LEVEL_INFO:  lvl = \"INFO\";  break;\n    case GGML_LOG_LEVEL_WARN:  lvl = \"WARN\";  break;\n    case GGML_LOG_LEVEL_ERROR: lvl = \"ERROR\"; break;\n    default: break;\n    }\n    fprintf(stderr, \"[%-5s] %s\", lvl, log);\n    fflush(stderr);\n}\n\nint mtl_load(const char *local_path, const char *codec_path,\n             const char *tokenizer_path) {\n    ggml_log_set(ggml_log_cb, nullptr);\n    ggml_backend_load_all();\n\n    if (!local_path || local_path[0] == '\\0') {\n        fprintf(stderr, \"[moss-tts-cpp] ERROR: local_path is required\\n\");\n        return 1;\n    }\n    if (!codec_path || codec_path[0] == '\\0') {\n        fprintf(stderr, \"[moss-tts-cpp] ERROR: codec_path is required\\n\");\n        return 2;\n    }\n    if (!tokenizer_path || tokenizer_path[0] == '\\0') {\n        fprintf(stderr, \"[moss-tts-cpp] ERROR: tokenizer_path is required\\n\");\n        return 3;\n    }\n\n    fprintf(stderr,\n            \"[moss-tts-cpp] Loading local=%s codec=%s tokenizer=%s\\n\",\n            local_path, codec_path, tokenizer_path);\n\n    g_local = moss_local_load(local_path, codec_path, tokenizer_path);\n    if (!g_local) {\n        fprintf(stderr, \"[moss-tts-cpp] FATAL: moss_local_load failed\\n\");","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/moss-tts-cpp/cpp/mossttscpp.cpp#L17-L53","documentation":"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.","triggerScenarios":"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).","commonSituations":"LocalAI backend config missing the model file entry; path template left unexpanded; caller passes an empty option struct by mistake.","solutions":["Set a valid local_path (the Moss TTS main model file) in the backend configuration before loading.","On the Go side, guard empty strings before invoking the C shim."],"exampleFix":"// before\nrc := C.mtl_load(C.CString(\"\"), codec, tok);\n// after\nif modelPath == \"\" { return errors.New(\"moss-tts-cpp: model path required\") }\nrc := C.mtl_load(C.CString(modelPath), codec, tok);","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(modelPath) == \"\" {\n    return errors.New(\"moss-tts-cpp: local_path is required\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate all three mtl_load arguments (model, codec, tokenizer) in Go before the FFI call.","Map return codes: 1=local_path, 2=codec_path, 3=tokenizer_path, 4=engine load."],"tags":["moss-tts-cpp","tts","argument-validation","model-loading"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}