mudler/LocalAI · warning
Embedding directory does not exist or is not a directory: %s
Error message
Embedding directory does not exist or is not a directory: %s\n
What it means
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.
Source
Thrown at backend/go/stablediffusion-ggml/cpp/gosd.cpp:66
// Storage for LoRAs (needs to persist for the lifetime of generation params)
static std::vector<sd_lora_t> lora_vec;
// Storage for LoRA strings (needs to persist as long as lora_vec references them)
static std::vector<std::string> lora_strings;
// Storage for lora_dir path
static std::string lora_dir_path;
// Build embeddings vector from directory, similar to upstream CLI
static void build_embedding_vec(const char* embedding_dir) {
embedding_vec.clear();
embedding_strings.clear();
if (!embedding_dir || strlen(embedding_dir) == 0) {
return;
}
if (!std::filesystem::exists(embedding_dir) || !std::filesystem::is_directory(embedding_dir)) {
fprintf(stderr, "Embedding directory does not exist or is not a directory: %s\n", embedding_dir);
return;
}
static const std::vector<std::string> valid_ext = {".pt", ".safetensors", ".gguf"};
for (const auto& entry : std::filesystem::directory_iterator(embedding_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) {
valid = true;
break;View on GitHub (pinned to 44413a9d06)
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
Example fix
# before options: "...,embeddings_dir=/model/embeddings" # does not exist # after mkdir -p /model/embeddings # or drop the option if unused
Defensive patterns
Strategy: validation
Validate before calling
// Go caller, before load
if opts.EmbeddingsDir != "" {
info, err := os.Stat(opts.EmbeddingsDir)
if err != nil || !info.IsDir() {
return fmt.Errorf("embeddings dir %q missing or not a directory", opts.EmbeddingsDir)
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- LoRA directory does not exist or is not a directory: %s\n
- LoRA directory not set, cannot parse LoRAs from prompt\n
- WARNING: LoRA file not found: %s\n
- Invalid rng_type: %s, using default\n
- Invalid sampler_rng_type: %s, using default\n
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/56484fb4ca906a2c.
Report an issue: GitHub.