{"record":{"id":"3840c4a8fde52b47","repo":"AUTOMATIC1111/stable-diffusion-webui","slug":"sampler-not-found","errorCode":null,"errorMessage":"Sampler not found","messagePattern":"Sampler not found","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"modules/api/api.py","lineNumber":46,"sourceCode":"from modules.realesrgan_model import get_realesrgan_models\nfrom modules import devices\nfrom typing import Any\nimport piexif\nimport piexif.helper\nfrom contextlib import closing\nfrom modules.progress import create_task_id, add_task_to_queue, start_task, finish_task, current_task\n\ndef script_name_to_index(name, scripts):\n    try:\n        return [script.title().lower() for script in scripts].index(name.lower())\n    except Exception as e:\n        raise HTTPException(status_code=422, detail=f\"Script '{name}' not found\") from e\n\n\ndef validate_sampler_name(name):\n    config = sd_samplers.all_samplers_map.get(name, None)\n    if config is None:\n        raise HTTPException(status_code=400, detail=\"Sampler not found\")\n\n    return name\n\n\ndef setUpscalers(req: dict):\n    reqDict = vars(req)\n    reqDict['extras_upscaler_1'] = reqDict.pop('upscaler_1', None)\n    reqDict['extras_upscaler_2'] = reqDict.pop('upscaler_2', None)\n    return reqDict\n\n\ndef verify_url(url):\n    \"\"\"Returns True if the url refers to a global resource.\"\"\"\n\n    import socket\n    from urllib.parse import urlparse\n    try:\n        parsed_url = urlparse(url)","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/82a973c04367123ae98bd9abdf80d9eda9b910e2/modules/api/api.py#L28-L64","documentation":"HTTP 400 raised by validate_sampler_name when the sampler_name in an API request has no entry in sd_samplers.all_samplers_map. This map is built from the sampler definitions the running webui knows (euler, dpm++ family, heun, etc., plus any registered by extensions), so an unknown or renamed sampler string is rejected before generation starts.","triggerScenarios":"POST /sdapi/v1/txt2img or /sdapi/v1/img2img with sampler_name like 'dpm++ 2m karras' instead of the split form (sampler_name='DPM++ 2M', scheduler='karras'); using a sampler added by a newer webui or an extension that is not installed; using deprecated sampler_index values that no longer resolve.","commonSituations":"Clients written against older API versions where combined sampler names were valid; k_diffusion sampler renames between releases (e.g. 'DPM adaptive' vs 'dpmadaptive'); extensions failing to load and thus not registering their samplers; typo or wrong case plus alias mismatch.","solutions":["GET /sdapi/v1/samplers and use one of the returned name values verbatim, splitting scheduler into the separate scheduler field","Update the webui so newly supported samplers exist, or install the extension that provides the sampler","Use a well-known stable sampler such as 'Euler' or 'DPM++ 2M' plus scheduler 'Karras'"],"exampleFix":"# before\njson={'prompt':'cat','sampler_name':'DPM++ 2M Karras'}\n\n# after\njson={'prompt':'cat','sampler_name':'DPM++ 2M','scheduler':'Karras'}","handlingStrategy":"validation","validationCode":"samplers = requests.get(f'{base}/sdapi/v1/samplers', auth=auth).json()\nnames = {s['name'] for s in samplers}\nif payload['sampler_name'] not in names:\n    payload['sampler_name'] = 'Euler'  # or raise\nif payload.get('scheduler') and payload['scheduler'].lower() not in {s.lower() for s in {'karras','exponential','sgm_uniform','simple','beta','normal','linear','dddim'}}:\n    payload['scheduler'] = None","typeGuard":"def sampler_is_valid(name: str, fetched_samplers: list[dict]) -> bool:\n    return name in {s['name'] for s in fetched_samplers}","tryCatchPattern":"resp = requests.post(txt2img_url, json=payload, auth=auth)\nif resp.status_code == 400 and resp.json()['detail'] == 'Sampler not found':\n    payload['sampler_name'] = 'DPM++ 2M'; payload['scheduler'] = 'Karras'\n    resp = requests.post(txt2img_url, json=payload, auth=auth)","preventionTips":["Cache the /sdapi/v1/samplers response per server version","Keep sampler_name and scheduler as separate fields","Never build sampler strings by concatenation"],"tags":["api","samplers","http-400","validation","stable-diffusion-webui"],"backgroundTag":null,"analyzedSha":"82a973c04367123ae98bd9abdf80d9eda9b910e2","analyzedAt":"2026-08-14T16:46:43.225Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}