AUTOMATIC1111/stable-diffusion-webui · error · HTTPException
Sampler not found
Error message
Sampler not found
What it means
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.
Source
Thrown at modules/api/api.py:46
from modules.realesrgan_model import get_realesrgan_models
from modules import devices
from typing import Any
import piexif
import piexif.helper
from contextlib import closing
from modules.progress import create_task_id, add_task_to_queue, start_task, finish_task, current_task
def script_name_to_index(name, scripts):
try:
return [script.title().lower() for script in scripts].index(name.lower())
except Exception as e:
raise HTTPException(status_code=422, detail=f"Script '{name}' not found") from e
def validate_sampler_name(name):
config = sd_samplers.all_samplers_map.get(name, None)
if config is None:
raise HTTPException(status_code=400, detail="Sampler not found")
return name
def setUpscalers(req: dict):
reqDict = vars(req)
reqDict['extras_upscaler_1'] = reqDict.pop('upscaler_1', None)
reqDict['extras_upscaler_2'] = reqDict.pop('upscaler_2', None)
return reqDict
def verify_url(url):
"""Returns True if the url refers to a global resource."""
import socket
from urllib.parse import urlparse
try:
parsed_url = urlparse(url)View on GitHub (pinned to 82a973c043)
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'
Example fix
# before
json={'prompt':'cat','sampler_name':'DPM++ 2M Karras'}
# after
json={'prompt':'cat','sampler_name':'DPM++ 2M','scheduler':'Karras'} Defensive patterns
Strategy: validation
Validate before calling
samplers = requests.get(f'{base}/sdapi/v1/samplers', auth=auth).json()
names = {s['name'] for s in samplers}
if payload['sampler_name'] not in names:
payload['sampler_name'] = 'Euler' # or raise
if payload.get('scheduler') and payload['scheduler'].lower() not in {s.lower() for s in {'karras','exponential','sgm_uniform','simple','beta','normal','linear','dddim'}}:
payload['scheduler'] = None Type guard
def sampler_is_valid(name: str, fetched_samplers: list[dict]) -> bool:
return name in {s['name'] for s in fetched_samplers} Try / catch
resp = requests.post(txt2img_url, json=payload, auth=auth)
if resp.status_code == 400 and resp.json()['detail'] == 'Sampler not found':
payload['sampler_name'] = 'DPM++ 2M'; payload['scheduler'] = 'Karras'
resp = requests.post(txt2img_url, json=payload, auth=auth) Prevention
- Cache the /sdapi/v1/samplers response per server version
- Keep sampler_name and scheduler as separate fields
- Never build sampler strings by concatenation
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid encoded image
- always on script {alwayson_script_name} not found
- Cannot have a selectable script in the always on scripts par
- Init image not found
- Image not found
AI-assisted analysis of AUTOMATIC1111/stable-diffusion-webui@82a973c043 (2026-08-14).
Data as JSON: /api/errors/3840c4a8fde52b47.
Report an issue: GitHub.