AUTOMATIC1111/stable-diffusion-webui · error · Exception

Could not find checkpoint with name

Error message

Could not find checkpoint with name {self.hr_checkpoint_name}

What it means

In StableDiffusionProcessingTxt2Img.init for hires-fix: when hr_checkpoint_name is set to something other than 'Use same checkpoint', it is resolved with sd_models.get_closet_checkpoint_match; None means no known checkpoint matches, and the Exception aborts before the first pass. It protects the second (hires) pass from running with an unloadable model.

Solutions

  1. Restore the checkpoint file referenced by hr_checkpoint_name and refresh the model list.
  2. Or set the dropdown/'hr_checkpoint_name' back to 'Use same checkpoint' so hires fix reuses the primary model.
  3. Verify the exact checkpoint title via the API (sdapi/v1/sd-models) and use a matching substring.

Example fix

# before
payload['hr_checkpoint_name'] = 'myDeletedModel.safetensors'  # Exception

# after
payload['hr_checkpoint_name'] = 'Use same checkpoint'
Defensive patterns

Strategy: validation

Validate before calling

from modules import sd_models

def validate_hr_checkpoint(name):
    if not name or name == 'Use same checkpoint':
        return True
    return sd_models.get_closet_checkpoint_match(name) is not None

if not validate_hr_checkpoint(payload.get('hr_checkpoint_name')):
    payload['hr_checkpoint_name'] = 'Use same checkpoint'

Type guard

def hires_checkpoint_ok(name: str) -> bool:
    return (not name) or name == 'Use same checkpoint' or sd_models.get_closet_checkpoint_match(name) is not None

Try / catch

try:
    processed = process_images(p)
except Exception as e:
    if 'Could not find checkpoint' in str(e) and getattr(p, 'hr_checkpoint_name', None):
        p.hr_checkpoint_name = 'Use same checkpoint'
        processed = process_images(p)
    else:
        raise

Prevention

When it happens

Trigger: Enabling hires fix with 'Hires checkpoint' set to a name that matches no checkpoint in models/Stable-diffusion — deleted file, typo, or a saved UI state referencing a model not present on this machine.

Common situations: Moving a webui install to another machine without copying all checkpoints; renaming model files while the dropdown retains the old title; API scripts hardcoding a hires checkpoint name.

Related errors


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

Appendix: source

Thrown at modules/processing.py:1260

                if src_ratio < dst_ratio:
                    self.hr_upscale_to_x = self.hr_resize_x
                    self.hr_upscale_to_y = self.hr_resize_x * self.height // self.width
                else:
                    self.hr_upscale_to_x = self.hr_resize_y * self.width // self.height
                    self.hr_upscale_to_y = self.hr_resize_y

                self.truncate_x = (self.hr_upscale_to_x - target_w) // opt_f
                self.truncate_y = (self.hr_upscale_to_y - target_h) // opt_f

    def init(self, all_prompts, all_seeds, all_subseeds):
        if self.enable_hr:
            self.extra_generation_params["Denoising strength"] = self.denoising_strength

            if self.hr_checkpoint_name and self.hr_checkpoint_name != 'Use same checkpoint':
                self.hr_checkpoint_info = sd_models.get_closet_checkpoint_match(self.hr_checkpoint_name)

                if self.hr_checkpoint_info is None:
                    raise Exception(f'Could not find checkpoint with name {self.hr_checkpoint_name}')

                self.extra_generation_params["Hires checkpoint"] = self.hr_checkpoint_info.short_title

            if self.hr_sampler_name is not None and self.hr_sampler_name != self.sampler_name:
                self.extra_generation_params["Hires sampler"] = self.hr_sampler_name

            def get_hr_prompt(p, index, prompt_text, **kwargs):
                hr_prompt = p.all_hr_prompts[index]
                return hr_prompt if hr_prompt != prompt_text else None

            def get_hr_negative_prompt(p, index, negative_prompt, **kwargs):
                hr_negative_prompt = p.all_hr_negative_prompts[index]
                return hr_negative_prompt if hr_negative_prompt != negative_prompt else None

            self.extra_generation_params["Hires prompt"] = get_hr_prompt
            self.extra_generation_params["Hires negative prompt"] = get_hr_negative_prompt

            self.extra_generation_params["Hires schedule type"] = None  # to be set in sd_samplers_kdiffusion.py

View on GitHub (pinned to 82a973c043)