mudler/LocalAI · warning

Invalid rng_type: %s, using default\n

Error message

Invalid rng_type: %s, using default\n

What it means

Warning from the option parser in the stablediffusion-ggml load path: the 'rng_type=<value>' option value is not recognized by str_to_rng_type(), so the library default RNG is used instead of the requested one. Parse continues; nothing aborts.

Source

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

        if (!strcmp(optname, "tae_preview_only")) tae_preview_only = (strcmp(optval, "true") == 0 || strcmp(optval, "1") == 0);
        if (!strcmp(optname, "diffusion_conv_direct")) diffusion_conv_direct = (strcmp(optval, "true") == 0 || strcmp(optval, "1") == 0);
        if (!strcmp(optname, "vae_conv_direct")) vae_conv_direct = (strcmp(optval, "true") == 0 || strcmp(optval, "1") == 0);
        if (!strcmp(optname, "force_sdxl_vae_conv_scale")) force_sdxl_vae_conv_scale = (strcmp(optval, "true") == 0 || strcmp(optval, "1") == 0);
        if (!strcmp(optname, "chroma_use_dit_mask")) chroma_use_dit_mask = (strcmp(optval, "true") == 0 || strcmp(optval, "1") == 0);
        if (!strcmp(optname, "chroma_use_t5_mask")) chroma_use_t5_mask = (strcmp(optval, "true") == 0 || strcmp(optval, "1") == 0);

        if (!strcmp(optname, "n_threads")) n_threads = atoi(optval);
        if (!strcmp(optname, "chroma_t5_mask_pad")) chroma_t5_mask_pad = atoi(optval);

        if (!strcmp(optname, "flow_shift")) flow_shift = atof(optval);

        if (!strcmp(optname, "rng_type")) {
            rng_type_t parsed = str_to_rng_type(optval);
            if (parsed != RNG_TYPE_COUNT) {
                rng_type = parsed;
                fprintf(stderr, "Found rng_type: %s\n", optval);
            } else {
                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);

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Use an exact, case-sensitive enum name accepted by the bundled stable-diffusion.cpp (check str_to_rng_type in the vendored source)
  2. Omit rng_type entirely to accept the default if the specific RNG does not matter
  3. After fixing, confirm the 'Found rng_type: <value>' line appears in the log instead of the warning

Example fix

# before
options: "...,rng_type=Xoroshiro128Plus"

# after (match the bundled enum spelling exactly)
options: "...,rng_type=xoroshiro128plus"
Defensive patterns

Strategy: validation

Validate before calling

// Go caller: whitelist option values before load
validRng := map[string]bool{"std_default": true, "xoroshiro128pp": true} // match vendored enum names
if o, ok := opts.Raw["rng_type"]; ok && !validRng[o] {
    return fmt.Errorf("invalid rng_type %q", o)
}

Prevention

When it happens

Trigger: Passing rng_type with a value outside the upstream stable-diffusion.cpp enum names (e.g. 'xoroshiro' misspelled, or a value valid only in a newer/older upstream version).

Common situations: Copying options between versions of stable-diffusion.cpp/LocalAI where enum names changed; case-sensitive typos; options sourced from model gallery YAML with stale values.

Related errors


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