{"record":{"id":"7d9ba6c6230d94bd","repo":"mudler/LocalAI","slug":"invalid-rng-type-s-using-default-n","errorCode":null,"errorMessage":"Invalid rng_type: %s, using default\\n","messagePattern":"Invalid rng_type: (.+?), using default\\\\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"backend/go/stablediffusion-ggml/cpp/gosd.cpp","lineNumber":541,"sourceCode":"        if (!strcmp(optname, \"tae_preview_only\")) tae_preview_only = (strcmp(optval, \"true\") == 0 || strcmp(optval, \"1\") == 0);\n        if (!strcmp(optname, \"diffusion_conv_direct\")) diffusion_conv_direct = (strcmp(optval, \"true\") == 0 || strcmp(optval, \"1\") == 0);\n        if (!strcmp(optname, \"vae_conv_direct\")) vae_conv_direct = (strcmp(optval, \"true\") == 0 || strcmp(optval, \"1\") == 0);\n        if (!strcmp(optname, \"force_sdxl_vae_conv_scale\")) force_sdxl_vae_conv_scale = (strcmp(optval, \"true\") == 0 || strcmp(optval, \"1\") == 0);\n        if (!strcmp(optname, \"chroma_use_dit_mask\")) chroma_use_dit_mask = (strcmp(optval, \"true\") == 0 || strcmp(optval, \"1\") == 0);\n        if (!strcmp(optname, \"chroma_use_t5_mask\")) chroma_use_t5_mask = (strcmp(optval, \"true\") == 0 || strcmp(optval, \"1\") == 0);\n\n        if (!strcmp(optname, \"n_threads\")) n_threads = atoi(optval);\n        if (!strcmp(optname, \"chroma_t5_mask_pad\")) chroma_t5_mask_pad = atoi(optval);\n\n        if (!strcmp(optname, \"flow_shift\")) flow_shift = atof(optval);\n\n        if (!strcmp(optname, \"rng_type\")) {\n            rng_type_t parsed = str_to_rng_type(optval);\n            if (parsed != RNG_TYPE_COUNT) {\n                rng_type = parsed;\n                fprintf(stderr, \"Found rng_type: %s\\n\", optval);\n            } else {\n                fprintf(stderr, \"Invalid rng_type: %s, using default\\n\", optval);\n            }\n        }\n        if (!strcmp(optname, \"sampler_rng_type\")) {\n            rng_type_t parsed = str_to_rng_type(optval);\n            if (parsed != RNG_TYPE_COUNT) {\n                sampler_rng_type = parsed;\n                fprintf(stderr, \"Found sampler_rng_type: %s\\n\", optval);\n            } else {\n                fprintf(stderr, \"Invalid sampler_rng_type: %s, using default\\n\", optval);\n            }\n        }\n        if (!strcmp(optname, \"prediction\")) {\n            prediction_t parsed = str_to_prediction(optval);\n            if (parsed != PREDICTION_COUNT) {\n                prediction = parsed;\n                fprintf(stderr, \"Found prediction: %s\\n\", optval);\n            } else {\n                fprintf(stderr, \"Invalid prediction: %s, using default\\n\", optval);","sourceCodeStart":523,"sourceCodeEnd":559,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/stablediffusion-ggml/cpp/gosd.cpp#L523-L559","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use an exact, case-sensitive enum name accepted by the bundled stable-diffusion.cpp (check str_to_rng_type in the vendored source)","Omit rng_type entirely to accept the default if the specific RNG does not matter","After fixing, confirm the 'Found rng_type: <value>' line appears in the log instead of the warning"],"exampleFix":"# before\noptions: \"...,rng_type=Xoroshiro128Plus\"\n\n# after (match the bundled enum spelling exactly)\noptions: \"...,rng_type=xoroshiro128plus\"","handlingStrategy":"validation","validationCode":"// Go caller: whitelist option values before load\nvalidRng := map[string]bool{\"std_default\": true, \"xoroshiro128pp\": true} // match vendored enum names\nif o, ok := opts.Raw[\"rng_type\"]; ok && !validRng[o] {\n    return fmt.Errorf(\"invalid rng_type %q\", o)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Maintain a whitelist of enum strings matching the vendored stable-diffusion.cpp and validate configs against it","Treat 'Invalid ... using default' log lines as config bugs to fix, not noise"],"tags":["stablediffusion","options","rng","config"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}