mudler/LocalAI · error

[acestep-cpp] ERROR: models not loaded\n

Error message

[acestep-cpp] ERROR: models not loaded\n

What it means

acestep-cpp guard inside generate_music(): it refuses to run unless both g_dit_loaded and g_vae_loaded are true (set only after successful load_model stages). Calling generation before a fully successful load returns 1 with this message — typically a client/orchestration bug that skipped or did not check load_model's return code.

Source

Thrown at backend/go/acestep-cpp/cpp/goacestepcpp.cpp:118

            return 2;
        }
    }

    // Load VAE model
    fprintf(stderr, "[acestep-cpp] Loading VAE from %s\n", vae_model_path);
    vae_ggml_load(&g_vae, vae_model_path);
    g_vae_loaded = true;

    fprintf(stderr, "[acestep-cpp] All models loaded successfully (turbo=%d)\n", g_is_turbo);
    return 0;
}

int generate_music(const char * caption, const char * lyrics, int bpm,
                   const char * keyscale, const char * timesignature,
                   float duration, float temperature, bool instrumental,
                   int seed, const char * dst, int threads) {
    if (!g_dit_loaded || !g_vae_loaded) {
        fprintf(stderr, "[acestep-cpp] ERROR: models not loaded\n");
        return 1;
    }

    const int FRAMES_PER_SECOND = 25;

    // Defaults
    if (duration <= 0)
        duration = 30.0f;
    std::string cap_str    = caption ? caption : "";
    std::string lyrics_str = (instrumental || !lyrics) ? "" : lyrics;
    std::string ks_str     = keyscale ? keyscale : "N/A";
    std::string ts_str     = timesignature ? timesignature : "4/4";
    std::string lang_str   = "unknown";
    char        bpm_str[16];
    if (bpm > 0) {
        snprintf(bpm_str, sizeof(bpm_str), "%d", bpm);
    } else {
        snprintf(bpm_str, sizeof(bpm_str), "N/A");

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Check load_model's return value; only expose generation after it returns 0.
  2. Gate the service endpoint behind a readiness flag set on successful load; return 503 until then.
  3. If load failed, fix per its log line (errors 154-156) and reload before retrying generation.

Example fix

// before
load_model(lm, te, dit, vae);          // return ignored
generate_music(...);                    // ERROR: models not loaded

// after
if (load_model(lm, te, dit, vae) != 0) {
    return fmt.Errorf("model load failed");
}
generate_music(...);
Defensive patterns

Strategy: type-guard

Validate before calling

// expose readiness only after a fully successful load
int rc = load_model(lm, te, dit, vae);
ready = (rc == 0);  // g_dit_loaded && g_vae_loaded are set on success
if (!ready) return rc;

Type guard

bool models_ready() {
    return g_dit_loaded && g_vae_loaded;  // mirrors generate_music's own guard
}

Prevention

When it happens

Trigger: Invoking generate_music after load_model returned 1/2/3 and the caller ignored it, or calling generate_music on a fresh process where load_model was never invoked; the boolean guard trips.

Common situations: Go binding callers not propagating load_model's error; race where a request arrives during model load; retries after a failed load that never re-attempt loading.

Related errors


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