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

  1. Create the directory (mkdir -p) or fix the typo in the embeddings_dir option so it points at a real directory
  2. If you do not use embeddings, remove the embeddings_dir option entirely (empty/absent is silently skipped)
  3. 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

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


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/56484fb4ca906a2c. Report an issue: GitHub.