{"record":{"id":"5ce5edcef3b875a9","repo":"Stability-AI/generative-models","slug":"unknown-sampler-params-sampler","errorCode":null,"errorMessage":"unknown sampler {params.sampler}!","messagePattern":"unknown sampler (.+?)!","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sgm/inference/api.py","lineNumber":363,"sourceCode":"            verbose=True,\r\n        )\r\n    if params.sampler == Sampler.DPMPP2M:\r\n        return DPMPP2MSampler(\r\n            num_steps=params.steps,\r\n            discretization_config=discretization_config,\r\n            guider_config=guider_config,\r\n            verbose=True,\r\n        )\r\n    if params.sampler == Sampler.LINEAR_MULTISTEP:\r\n        return LinearMultistepSampler(\r\n            num_steps=params.steps,\r\n            discretization_config=discretization_config,\r\n            guider_config=guider_config,\r\n            order=params.order,\r\n            verbose=True,\r\n        )\r\n\r\n    raise ValueError(f\"unknown sampler {params.sampler}!\")\r\n","sourceCodeStart":345,"sourceCodeEnd":364,"githubUrl":"https://github.com/Stability-AI/generative-models/blob/e8cd657656fa5d61688191730d0e03242bf4ed44/sgm/inference/api.py#L345-L364","documentation":"get_sampler_config builds the sampler object by branching on SamplingParams.sampler (euler, ddim, dpm_solver2, etc.). When none of the branches match it falls through to this ValueError at the end of the function. It is called by text_to_image, image_to_image and refiner, so any inference entry point with a bad sampler name hits it.","triggerScenarios":"Calling text_to_image(SamplingParams(sampler=\"dpm++2m\")) or any sampler string not in the if/elif chain of get_sampler_config — e.g. unsupported names borrowed from other libraries (\"k_euler\", \"uni_pc\") or typos.","commonSituations":"Porting sampler names from A1111/ComfyUI/comfy workflows where sampler naming differs; typos like \"dpm_solver_2\" vs \"dpm_solver2\"; building sampler strings dynamically from config files with stale names.","solutions":["Use one of the supported values of SamplingParams.sampler as defined in sgm/inference/api.py (e.g. \"euler\", \"ddim\", \"dpm_solver2\").","Check the branch conditions in get_sampler_config for exact accepted strings and match case/underscores.","If a new sampler is required, add a branch in get_sampler_config constructing its Sampler object."],"exampleFix":"// before\nparams = SamplingParams(sampler=\"k_euler\", discretization=\"ddpm\")\n// after\nparams = SamplingParams(sampler=\"euler\", discretization=\"ddpm\")","handlingStrategy":"validation","validationCode":"VALID_SAMPLERS = {\"euler\", \"euler_ancestral\", \"dpmpp_2m_sde\", \"dpmpp_sde\", \"ddim\", \"uni_pc\"}  # per sgm/inference/api.py\nassert params.sampler in VALID_SAMPLERS, f\"{params.sampler!r} not supported\"","typeGuard":"SamplerId = Literal[\"euler\", \"euler_ancestral\", \"dpmpp_2m_sde\", \"dpmpp_sde\", \"ddim\", \"uni_pc\"]\ndef is_valid_sampler(x: str) -> bool:\n    return x in get_args(SamplerId)","tryCatchPattern":"try:\n    out = text_to_image(params=params)\nexcept ValueError as e:\n    if \"unknown sampler\" in str(e):\n        params.sampler = \"euler\"  # safe default\n        out = text_to_image(params=params)","preventionTips":["Do not copy sampler names from A1111/ComfyUI; use this library's exact naming.","Type-annotate SamplingParams.sampler with a Literal/enum of supported values."],"tags":["configuration","sampler","enum-validation"],"backgroundTag":"invalid-config-value","analyzedSha":"e8cd657656fa5d61688191730d0e03242bf4ed44","analyzedAt":"2026-08-29T11:23:43.234Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}