mudler/LocalAI · warning

Invalid prediction: %s, using default\n

Error message

Invalid prediction: %s, using default\n

What it means

Warning from the option parser: the 'prediction=<value>' option (epsilon/v/x0-style noise prediction type) failed to parse via str_to_prediction(), so the model default prediction type is kept. This can subtly change sampling behavior, so it is worth fixing even though load succeeds.

Source

Thrown at backend/go/stablediffusion-ggml/cpp/gosd.cpp:559

                fprintf(stderr, "Invalid rng_type: %s, using default\n", optval);
            }
        }
        if (!strcmp(optname, "sampler_rng_type")) {
            rng_type_t parsed = str_to_rng_type(optval);
            if (parsed != RNG_TYPE_COUNT) {
                sampler_rng_type = parsed;
                fprintf(stderr, "Found sampler_rng_type: %s\n", optval);
            } else {
                fprintf(stderr, "Invalid sampler_rng_type: %s, using default\n", optval);
            }
        }
        if (!strcmp(optname, "prediction")) {
            prediction_t parsed = str_to_prediction(optval);
            if (parsed != PREDICTION_COUNT) {
                prediction = parsed;
                fprintf(stderr, "Found prediction: %s\n", optval);
            } else {
                fprintf(stderr, "Invalid prediction: %s, using default\n", optval);
            }
        }
        if (!strcmp(optname, "lora_apply_mode")) {
            lora_apply_mode_t parsed = str_to_lora_apply_mode(optval);
            if (parsed != LORA_APPLY_MODE_COUNT) {
                lora_apply_mode = parsed;
                fprintf(stderr, "Found lora_apply_mode: %s\n", optval);
            } else {
                fprintf(stderr, "Invalid lora_apply_mode: %s, using default\n", optval);
            }
        }
        if (!strcmp(optname, "wtype")) {
            sd_type_t parsed = str_to_sd_type(optval);
            if (parsed != SD_TYPE_COUNT) {
                wtype = parsed;
                fprintf(stderr, "Found wtype: %s\n", optval);
            } else {
                fprintf(stderr, "Invalid wtype: %s, using default\n", optval);

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Set prediction to an exact enum name from the vendored str_to_prediction
  2. If unsure, drop the option and let the model default apply
  3. Verify the fix by finding 'Found prediction:' in the backend log

Example fix

# before
options: "...,prediction=X0-Prediction"

# after
options: "...,prediction=x0"
Defensive patterns

Strategy: validation

Validate before calling

// Go caller: whitelist prediction values
validPrediction := map[string]bool{"epsilon": true, "v": true, "x0": true} // match vendored names
if o, ok := opts.Raw["prediction"]; ok && !validPrediction[o] {
    return fmt.Errorf("invalid prediction %q", o)
}

Prevention

When it happens

Trigger: Passing prediction with an unrecognized string; flow-matching models (e.g. Flux/Chroma) that need a specific prediction value where the name was misspelled or not supported by the vendored library version.

Common situations: Model configs tuned for a newer stable-diffusion.cpp fork used against an older bundled copy; case errors like 'X0' vs 'x0'.

Related errors


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