{"record":{"id":"2b59d43fb4b1ba68","repo":"mudler/LocalAI","slug":"moss-tts-cpp-error-codec-path-is-required-n","errorCode":null,"errorMessage":"[moss-tts-cpp] ERROR: codec_path is required\\n","messagePattern":"\\[moss-tts-cpp\\] ERROR: codec_path is required\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/go/moss-tts-cpp/cpp/mossttscpp.cpp","lineNumber":39,"sourceCode":"    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\");\n        return 4;\n    }\n    fprintf(stderr, \"[moss-tts-cpp] Model loaded (%s)\\n\", moss_tts_version());\n    return 0;","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/moss-tts-cpp/cpp/mossttscpp.cpp#L21-L57","documentation":"mtl_load() rejects the call because codec_path is NULL or empty (return 2), after local_path already passed validation. Moss TTS requires a companion codec model in addition to the main model; this check enforces that the codec file path is supplied before moss_local_load is attempted.","triggerScenarios":"Calling mtl_load(model, \"\", tokenizer) — codec companion file not configured. The codec is a separate artifact from the main model, so a config that only lists the model triggers this.","commonSituations":"Backend config omits the codec companion entry (separate download from the main model); gallery entry only installs the main weights.","solutions":["Download and configure the codec companion file, pass it as codec_path.","Validate all three paths on the Go side before calling mtl_load."],"exampleFix":"// before\nrc := C.mtl_load(m, C.CString(\"\"), t);\n// after\nrc := C.mtl_load(m, C.CString(cfg.CodecPath), t);","handlingStrategy":"validation","validationCode":"if strings.TrimSpace(codecPath) == \"\" {\n    return errors.New(\"moss-tts-cpp: codec_path is required\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember Moss TTS needs three artifacts, not one: model, codec, tokenizer.","Use the gallery entry so the codec companion is installed automatically."],"tags":["moss-tts-cpp","tts","argument-validation","codec"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}