{"record":{"id":"62ecdc0249b6426d","repo":"mudler/LocalAI","slug":"lora-directory-does-not-exist-or-is-not-a-director","errorCode":null,"errorMessage":"LoRA directory does not exist or is not a directory: %s\\n","messagePattern":"LoRA 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":119,"sourceCode":"\n        embedding_vec.push_back(item);\n        fprintf(stderr, \"Found embedding: %s -> %s\\n\", item.name, item.path);\n    }\n\n    fprintf(stderr, \"Loaded %zu embeddings from %s\\n\", embedding_vec.size(), embedding_dir);\n}\n\n// Discover LoRA files in directory and build a map of name -> path\nstatic std::map<std::string, std::string> discover_lora_files(const char* lora_dir) {\n    std::map<std::string, std::string> lora_map;\n\n    if (!lora_dir || strlen(lora_dir) == 0) {\n        fprintf(stderr, \"LoRA directory not specified\\n\");\n        return lora_map;\n    }\n\n    if (!std::filesystem::exists(lora_dir) || !std::filesystem::is_directory(lora_dir)) {\n        fprintf(stderr, \"LoRA directory does not exist or is not a directory: %s\\n\", lora_dir);\n        return lora_map;\n    }\n\n    static const std::vector<std::string> valid_ext = {\".safetensors\", \".ckpt\", \".pt\", \".gguf\"};\n\n    fprintf(stderr, \"Discovering LoRA files in: %s\\n\", lora_dir);\n\n    for (const auto& entry : std::filesystem::directory_iterator(lora_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) {","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/stablediffusion-ggml/cpp/gosd.cpp#L101-L137","documentation":"Warning from discover_lora_files() in the stablediffusion-ggml shim: the configured LoRA directory does not exist or is not a directory, so the name->path LoRA lookup map is empty. Generation still runs; any <lora:...> tags in prompts will later fail to resolve (see the 'LoRA file not found' warning).","triggerScenarios":"Setting lora_dir=<path> in the model load options where the path is missing, mistyped, a plain file, or relative to the wrong working directory.","commonSituations":"LoRA weights stored elsewhere than the configured default; docker volume not mounted at the expected path; per-user model directories where only some users have the lora folder.","solutions":["Create the LoRA directory or correct the lora_dir option value","Confirm it is a directory, not a file (e.g. pointing lora_dir directly at a .safetensors file triggers this)","If LoRAs are not used, leave lora_dir unset to avoid the warning (the load-time warning 212 will note it)"],"exampleFix":"# before\noptions: \"...,lora_dir=/models/loras\"  # missing\n\n# after\nmkdir -p /models/loras && cp ~/loras/*.safetensors /models/loras/","handlingStrategy":"validation","validationCode":"// Go caller, before load\nif opts.LoraDir != \"\" {\n    info, err := os.Stat(opts.LoraDir)\n    if err != nil || !info.IsDir() {\n        return fmt.Errorf(\"lora dir %q missing or not a directory\", opts.LoraDir)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check lora_dir exists and is a directory at startup","Do not point lora_dir at a single .safetensors file — it must be a directory","Log the resolved absolute path so mis-resolution of relative paths is visible"],"tags":["stablediffusion","lora","filesystem","config"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}