AUTOMATIC1111/stable-diffusion-webui · error · RuntimeError

model {checkpoint_name!r} not found

Error message

model {checkpoint_name!r} not found

What it means

RuntimeError raised by the set_config endpoint (/sdapi/v1/options, POST) when the request dict contains sd_model_checkpoint with a value that is not a key in sd_models.checkpoint_aliases. checkpoint_aliases maps both filenames and short hashes of every known checkpoint; the model swap is refused before any option is applied. Because this is a plain RuntimeError (not HTTPException), the API middleware converts it into a 500 with the message embedded in the response.

Source

Thrown at modules/api/api.py:681

    def skip(self):
        shared.state.skip()

    def get_config(self):
        options = {}
        for key in shared.opts.data.keys():
            metadata = shared.opts.data_labels.get(key)
            if(metadata is not None):
                options.update({key: shared.opts.data.get(key, shared.opts.data_labels.get(key).default)})
            else:
                options.update({key: shared.opts.data.get(key, None)})

        return options

    def set_config(self, req: dict[str, Any]):
        checkpoint_name = req.get("sd_model_checkpoint", None)
        if checkpoint_name is not None and checkpoint_name not in sd_models.checkpoint_aliases:
            raise RuntimeError(f"model {checkpoint_name!r} not found")

        for k, v in req.items():
            shared.opts.set(k, v, is_api=True)

        shared.opts.save(shared.config_filename)
        return

    def get_cmd_flags(self):
        return vars(shared.cmd_opts)

    def get_samplers(self):
        return [{"name": sampler[0], "aliases":sampler[2], "options":sampler[3]} for sampler in sd_samplers.all_samplers]

    def get_schedulers(self):
        return [
            {
                "name": scheduler.name,
                "label": scheduler.label,

View on GitHub (pinned to 82a973c043)

Solutions

  1. GET /sdapi/v1/sd-models (or /sdapi/v1/options -> sd_model_checkpoint enum) and copy the exact title
  2. Verify the checkpoint file exists under models/Stable-diffusion (or your --ckpt-dir) and refresh the checkpoint list in the UI (top-left refresh icon) before retrying
  3. Send only the exact filename with extension, no leading path and no hash suffix

Example fix

# before
requests.post(url+'/sdapi/v1/options', json={'sd_model_checkpoint':'v1-5.safetensors'})

# after
models = requests.get(url+'/sdapi/v1/sd-models').json()
title = next(m['title'] for m in models if 'v1-5' in m['title'])
requests.post(url+'/sdapi/v1/options', json={'sd_model_checkpoint':title})
Defensive patterns

Strategy: validation

Validate before calling

models = requests.get(f'{base}/sdapi/v1/sd-models', auth=auth).json()
titles = {m['title'] for m in models}
want = payload['sd_model_checkpoint']
if want not in titles:
    import difflib
    match = difflib.get_close_matches(want, titles, n=1)
    payload['sd_model_checkpoint'] = match[0] if match else None  # None skips the swap

Type guard

def checkpoint_is_known(title: str, fetched_models: list[dict]) -> bool:
    return title in {m['title'] for m in fetched_models}

Try / catch

try:
    requests.post(f'{base}/sdapi/v1/options', json={'sd_model_checkpoint': title}, auth=auth).raise_for_status()
except requests.HTTPError:
    # RuntimeError surfaces as 500; re-fetch valid titles and surface a clear error
    valid = [m['title'] for m in requests.get(f'{base}/sdapi/v1/sd-models', auth=auth).json()]
    raise ValueError(f'unknown checkpoint {title!r}; valid: {valid}')

Prevention

When it happens

Trigger: POST /sdapi/v1/options {"sd_model_checkpoint": "v1-5-pruned.safetensors"} when no file/hash with that name exists in model paths; passing a hash alias from a different install; checkpoint list not yet refreshed after adding files; typos or wrong subfolder prefixes.

Common situations: Automation switching models by name hardcoded from another machine; models stored under a different directory (custom --ckpt-dir); whitespace or '[hash]' suffixes included in the string; models added after server start without a refresh.

Related errors


AI-assisted analysis of AUTOMATIC1111/stable-diffusion-webui@82a973c043 (2026-08-14). Data as JSON: /api/errors/da5a8ab632ab8b36. Report an issue: GitHub.