mudler/LocalAI · warning
Invalid wtype: %s, using default\n
Error message
Invalid wtype: %s, using default\n
What it means
Warning from the option parser: 'wtype=<value>' (weight quantization type, e.g. f16/q8_0/q4_0) is not recognized by str_to_sd_type(), so the model's own default weight type is used (ctx_params.wtype is only assigned when the parse succeeded). Load proceeds; the model may use a different precision than intended, affecting VRAM and quality.
Source
Thrown at backend/go/stablediffusion-ggml/cpp/gosd.cpp:577
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);
fprintf (stderr, "Creating context\n");
sd_ctx_params_init(&ctx_params);
ctx_params.model_path = model;
ctx_params.clip_l_path = clip_l_path;
ctx_params.clip_g_path = clip_g_path;
ctx_params.clip_vision_path = clip_vision_path;
ctx_params.t5xxl_path = t5xxl_path;
ctx_params.llm_path = llm_path;
ctx_params.llm_vision_path = llm_vision_path;View on GitHub (pinned to 44413a9d06)
Solutions
- Use an exact sd_type name from the vendored str_to_sd_type (e.g. f16, q8_0, q4_0)
- Omit wtype to accept the model default precision
- Watch for the 'Found wtype:' confirmation line to verify it took effect
Example fix
# before options: "...,wtype=Q8" # not a valid sd type string # after options: "...,wtype=q8_0"
Defensive patterns
Strategy: validation
Validate before calling
// Go caller: whitelist weight types
validWtype := map[string]bool{"f32": true, "f16": true, "q8_0": true, "q4_0": true} // match vendored names
if o, ok := opts.Raw["wtype"]; ok && !validWtype[o] {
return fmt.Errorf("invalid wtype %q", o)
} Prevention
- Use sd.cpp weight-type spellings, not llama.cpp quant abbreviations
- Verify quantization actually applied by checking the 'Found wtype:' line and memory usage
When it happens
Trigger: Passing a wtype string not supported by the vendored stable-diffusion.cpp (unsupported quant name, typo, wrong case).
Common situations: Trying to shrink a large model with a quant name that this build does not implement; copying ggml quant names from llama.cpp that sd.cpp spells differently.
Related errors
- Invalid rng_type: %s, using default\n
- Invalid sampler_rng_type: %s, using default\n
- Invalid prediction: %s, using default\n
- Invalid lora_apply_mode: %s, using default\n
- Embedding directory does not exist or is not a directory: %s
AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15).
Data as JSON: /api/errors/47a1539149070b43.
Report an issue: GitHub.