{"record":{"id":"56484fb4ca906a2c","repo":"mudler/LocalAI","slug":"embedding-directory-does-not-exist-or-is-not-a-dir","errorCode":null,"errorMessage":"Embedding directory does not exist or is not a directory: %s\\n","messagePattern":"Embedding directory does not exist or is not a directory: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/go/stablediffusion-ggml/cpp/gosd.cpp","lineNumber":66,"sourceCode":"\n// Storage for LoRAs (needs to persist for the lifetime of generation params)\nstatic std::vector<sd_lora_t> lora_vec;\n// Storage for LoRA strings (needs to persist as long as lora_vec references them)\nstatic std::vector<std::string> lora_strings;\n// Storage for lora_dir path\nstatic std::string lora_dir_path;\n\n// Build embeddings vector from directory, similar to upstream CLI\nstatic void build_embedding_vec(const char* embedding_dir) {\n    embedding_vec.clear();\n    embedding_strings.clear();\n\n    if (!embedding_dir || strlen(embedding_dir) == 0) {\n        return;\n    }\n\n    if (!std::filesystem::exists(embedding_dir) || !std::filesystem::is_directory(embedding_dir)) {\n        fprintf(stderr, \"Embedding directory does not exist or is not a directory: %s\\n\", embedding_dir);\n        return;\n    }\n\n    static const std::vector<std::string> valid_ext = {\".pt\", \".safetensors\", \".gguf\"};\n\n    for (const auto& entry : std::filesystem::directory_iterator(embedding_dir)) {\n        if (!entry.is_regular_file()) {\n            continue;\n        }\n\n        auto path = entry.path();\n        std::string ext = path.extension().string();\n\n        bool valid = false;\n        for (const auto& e : valid_ext) {\n            if (ext == e) {\n                valid = true;\n                break;","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/stablediffusion-ggml/cpp/gosd.cpp#L48-L84","documentation":"A soft warning from the stablediffusion-ggml backend shim: the embeddings directory passed via the model options does not exist or is not a directory, so build_embedding_vec() returns an empty embedding list and generation proceeds without textual-inversion embeddings. It does not abort the load; the message names the offending path.","triggerScenarios":"Calling the load function with an 'embeddings_dir=<path>' option where <path> is missing, is a file rather than a directory, or is a relative path resolved against an unexpected working directory.","commonSituations":"Container/deployment configs pointing at /models/embeddings that was never mounted; a typo in the path; an empty-string path is silently skipped but a wrong non-empty path warns; moving a model folder without updating the config.","solutions":["Create the directory (mkdir -p) or fix the typo in the embeddings_dir option so it points at a real directory","If you do not use embeddings, remove the embeddings_dir option entirely (empty/absent is silently skipped)","Verify with ls -la <path> from the same working directory/container the backend runs in"],"exampleFix":"# before\noptions: \"...,embeddings_dir=/model/embeddings\"  # does not exist\n\n# after\nmkdir -p /model/embeddings   # or drop the option if unused","handlingStrategy":"validation","validationCode":"// Go caller, before load\nif opts.EmbeddingsDir != \"\" {\n    info, err := os.Stat(opts.EmbeddingsDir)\n    if err != nil || !info.IsDir() {\n        return fmt.Errorf(\"embeddings dir %q missing or not a directory\", opts.EmbeddingsDir)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate every configured directory path at backend startup and fail fast with the path name","Omit unused options instead of pointing them at nonexistent paths","In containers, assert required mounts exist before starting the model"],"tags":["stablediffusion","embeddings","filesystem","config"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}