{"record":{"id":"da5a8ab632ab8b36","repo":"AUTOMATIC1111/stable-diffusion-webui","slug":"model-checkpoint-name-r-not-found","errorCode":null,"errorMessage":"model {checkpoint_name!r} not found","messagePattern":"model (.+?) not found","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"modules/api/api.py","lineNumber":681,"sourceCode":"\n    def skip(self):\n        shared.state.skip()\n\n    def get_config(self):\n        options = {}\n        for key in shared.opts.data.keys():\n            metadata = shared.opts.data_labels.get(key)\n            if(metadata is not None):\n                options.update({key: shared.opts.data.get(key, shared.opts.data_labels.get(key).default)})\n            else:\n                options.update({key: shared.opts.data.get(key, None)})\n\n        return options\n\n    def set_config(self, req: dict[str, Any]):\n        checkpoint_name = req.get(\"sd_model_checkpoint\", None)\n        if checkpoint_name is not None and checkpoint_name not in sd_models.checkpoint_aliases:\n            raise RuntimeError(f\"model {checkpoint_name!r} not found\")\n\n        for k, v in req.items():\n            shared.opts.set(k, v, is_api=True)\n\n        shared.opts.save(shared.config_filename)\n        return\n\n    def get_cmd_flags(self):\n        return vars(shared.cmd_opts)\n\n    def get_samplers(self):\n        return [{\"name\": sampler[0], \"aliases\":sampler[2], \"options\":sampler[3]} for sampler in sd_samplers.all_samplers]\n\n    def get_schedulers(self):\n        return [\n            {\n                \"name\": scheduler.name,\n                \"label\": scheduler.label,","sourceCodeStart":663,"sourceCodeEnd":699,"githubUrl":"https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/82a973c04367123ae98bd9abdf80d9eda9b910e2/modules/api/api.py#L663-L699","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["GET /sdapi/v1/sd-models (or /sdapi/v1/options -> sd_model_checkpoint enum) and copy the exact title","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","Send only the exact filename with extension, no leading path and no hash suffix"],"exampleFix":"# before\nrequests.post(url+'/sdapi/v1/options', json={'sd_model_checkpoint':'v1-5.safetensors'})\n\n# after\nmodels = requests.get(url+'/sdapi/v1/sd-models').json()\ntitle = next(m['title'] for m in models if 'v1-5' in m['title'])\nrequests.post(url+'/sdapi/v1/options', json={'sd_model_checkpoint':title})","handlingStrategy":"validation","validationCode":"models = requests.get(f'{base}/sdapi/v1/sd-models', auth=auth).json()\ntitles = {m['title'] for m in models}\nwant = payload['sd_model_checkpoint']\nif want not in titles:\n    import difflib\n    match = difflib.get_close_matches(want, titles, n=1)\n    payload['sd_model_checkpoint'] = match[0] if match else None  # None skips the swap","typeGuard":"def checkpoint_is_known(title: str, fetched_models: list[dict]) -> bool:\n    return title in {m['title'] for m in fetched_models}","tryCatchPattern":"try:\n    requests.post(f'{base}/sdapi/v1/options', json={'sd_model_checkpoint': title}, auth=auth).raise_for_status()\nexcept requests.HTTPError:\n    # RuntimeError surfaces as 500; re-fetch valid titles and surface a clear error\n    valid = [m['title'] for m in requests.get(f'{base}/sdapi/v1/sd-models', auth=auth).json()]\n    raise ValueError(f'unknown checkpoint {title!r}; valid: {valid}')","preventionTips":["Never hardcode checkpoint names across machines","Refresh the model list after adding .safetensors files","Use the exact title from /sdapi/v1/sd-models (filename + hash format)"],"tags":["api","checkpoints","configuration","runtimeerror","stable-diffusion-webui"],"backgroundTag":null,"analyzedSha":"82a973c04367123ae98bd9abdf80d9eda9b910e2","analyzedAt":"2026-08-14T16:46:43.225Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}