mudler/LocalAI · warning
Invalid lora_apply_mode: %s, using default\n
Error message
Invalid lora_apply_mode: %s, using default\n
What it means
Warning from the option parser: 'lora_apply_mode=<value>' is not recognized by str_to_lora_apply_mode(), so the default LoRA application strategy (how LoRA weights are merged, e.g. at load vs per-generation) is used. Parse and load continue normally.
Source
Thrown at backend/go/stablediffusion-ggml/cpp/gosd.cpp:568
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);
}
}
}
fprintf(stderr, "parsed options\n");
// Build embeddings vector from directory if provided
build_embedding_vec(embedding_dir);
View on GitHub (pinned to 44413a9d06)
Solutions
- Use an exact enum name accepted by the vendored str_to_lora_apply_mode
- Omit the option to keep the default behavior
- Confirm via the 'Found lora_apply_mode:' log line
Example fix
# before options: "...,lora_apply_mode=AtLoad" # after options: "...,lora_apply_mode=at_load"
Defensive patterns
Strategy: validation
Validate before calling
// Go caller: whitelist lora_apply_mode values
validApplyMode := map[string]bool{"at_load": true, "per_prompt": true} // match vendored names
if o, ok := opts.Raw["lora_apply_mode"]; ok && !validApplyMode[o] {
return fmt.Errorf("invalid lora_apply_mode %q", o)
} Prevention
- Document which LoRA apply modes the vendored build supports next to your model configs
- Validate option strings once at config load, not per request
When it happens
Trigger: Passing an invalid or version-mismatched lora_apply_mode string in the load options; some modes only exist in specific upstream stable-diffusion.cpp versions.
Common situations: Tuning LoRA behavior (apply-at-load for speed vs apply-per-prompt for flexibility) with a misspelled mode name; configs ported from sd.cpp forks.
Related errors
- LoRA directory does not exist or is not a directory: %s\n
- LoRA directory not set, cannot parse LoRAs from prompt\n
- Invalid rng_type: %s, using default\n
- Invalid sampler_rng_type: %s, using default\n
- Invalid prediction: %s, using default\n
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/ae5b5a4e3e78d0ac.
Report an issue: GitHub.