mudler/LocalAI · warning
LoRA directory does not exist or is not a directory: %s\n
Error message
LoRA directory does not exist or is not a directory: %s\n
What it means
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).
Source
Thrown at backend/go/stablediffusion-ggml/cpp/gosd.cpp:119
embedding_vec.push_back(item);
fprintf(stderr, "Found embedding: %s -> %s\n", item.name, item.path);
}
fprintf(stderr, "Loaded %zu embeddings from %s\n", embedding_vec.size(), embedding_dir);
}
// Discover LoRA files in directory and build a map of name -> path
static std::map<std::string, std::string> discover_lora_files(const char* lora_dir) {
std::map<std::string, std::string> lora_map;
if (!lora_dir || strlen(lora_dir) == 0) {
fprintf(stderr, "LoRA directory not specified\n");
return lora_map;
}
if (!std::filesystem::exists(lora_dir) || !std::filesystem::is_directory(lora_dir)) {
fprintf(stderr, "LoRA directory does not exist or is not a directory: %s\n", lora_dir);
return lora_map;
}
static const std::vector<std::string> valid_ext = {".safetensors", ".ckpt", ".pt", ".gguf"};
fprintf(stderr, "Discovering LoRA files in: %s\n", lora_dir);
for (const auto& entry : std::filesystem::directory_iterator(lora_dir)) {
if (!entry.is_regular_file()) {
continue;
}
auto path = entry.path();
std::string ext = path.extension().string();
bool valid = false;
for (const auto& e : valid_ext) {
if (ext == e) {View on GitHub (pinned to 44413a9d06)
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)
Example fix
# before options: "...,lora_dir=/models/loras" # missing # after mkdir -p /models/loras && cp ~/loras/*.safetensors /models/loras/
Defensive patterns
Strategy: validation
Validate before calling
// Go caller, before load
if opts.LoraDir != "" {
info, err := os.Stat(opts.LoraDir)
if err != nil || !info.IsDir() {
return fmt.Errorf("lora dir %q missing or not a directory", opts.LoraDir)
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Embedding directory does not exist or is not a directory: %s
- LoRA directory not set, cannot parse LoRAs from prompt\n
- WARNING: LoRA file not found: %s\n
- Invalid lora_apply_mode: %s, using default\n
- WARNING: LoRA model directory not set. LoRAs in prompts will
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/62ecdc0249b6426d.
Report an issue: GitHub.