AUTOMATIC1111/stable-diffusion-webui · error · Exception

could not find upscaler named {self.hr_upscaler}

Error message

could not find upscaler named {self.hr_upscaler}

What it means

During hires-fix init, self.latent_scale_mode is looked up in shared.latent_upscale_modes for the chosen hr_upscaler; if hr_upscaler names a non-latent (model) upscaler, the code then searches shared.sd_upscalers for a matching name, and raising this Exception when none is found. So the name is neither a latent upscaler mode nor a registered upscaler object.

Source

Thrown at modules/processing.py:1286

                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

            if self.hr_scheduler is None:
                self.hr_scheduler = self.scheduler

            self.latent_scale_mode = shared.latent_upscale_modes.get(self.hr_upscaler, None) if self.hr_upscaler is not None else shared.latent_upscale_modes.get(shared.latent_upscale_default_mode, "nearest")
            if self.enable_hr and self.latent_scale_mode is None:
                if not any(x.name == self.hr_upscaler for x in shared.sd_upscalers):
                    raise Exception(f"could not find upscaler named {self.hr_upscaler}")

            self.calculate_target_resolution()

            if not state.processing_has_refined_job_count:
                if state.job_count == -1:
                    state.job_count = self.n_iter
                if getattr(self, 'txt2img_upscale', False):
                    total_steps = (self.hr_second_pass_steps or self.steps) * state.job_count
                else:
                    total_steps = (self.steps + (self.hr_second_pass_steps or self.steps)) * state.job_count
                shared.total_tqdm.updateTotal(total_steps)
                state.job_count = state.job_count * 2
                state.processing_has_refined_job_count = True

            if self.hr_second_pass_steps:
                self.extra_generation_params["Hires steps"] = self.hr_second_pass_steps

            if self.hr_upscaler is not None:

View on GitHub (pinned to 82a973c043)

Solutions

  1. Use the exact upscaler name from the UI dropdown / shared.sd_upscalers (query sdapi/v1/upscalers to list valid names).
  2. For latent-space upscaling use one of the latent mode strings ('Latent', 'Latent (nearest)', 'Latent (antialiased)', 'Latent (nearest-exact)', 'Latent (bicubic)').
  3. If the upscaler comes from an extension, ensure the extension is enabled and its model files are present so it registers at startup.

Example fix

# before
payload['hr_upscaler'] = 'REALESRGAN x4+'  # Exception

# after
payload['hr_upscaler'] = 'R-ESRGAN 4x+'    # exact registered name
Defensive patterns

Strategy: validation

Validate before calling

import modules.shared as shared

def valid_hr_upscaler(name):
    if name in shared.latent_upscale_modes:
        return True
    return any(x.name == name for x in shared.sd_upscalers)

if not valid_hr_upscaler(payload['hr_upscaler']):
    payload['hr_upscaler'] = 'Latent'  # or pick from shared.sd_upscalers names

Type guard

def is_known_upscaler(name: str) -> bool:
    return name in shared.latent_upscale_modes or any(u.name == name for u in shared.sd_upscalers)

Try / catch

try:
    processed = process_images(p)
except Exception as e:
    if 'could not find upscaler' in str(e):
        p.hr_upscaler = 'Latent'
        processed = process_images(p)
    else:
        raise

Prevention

When it happens

Trigger: Passing hr_upscaler set to a name that is not one of the latent modes ('Latent', 'Latent (antialiased)', 'Latent (nearest)', ...) and also not present in shared.sd_upscalers (e.g. a misspelled 'REALESRGAN x4+' vs 'R-ESRGAN 4x+', or an upscaler whose model failed to register).

Common situations: API payloads or scripts with hard-coded upscaler names that drifted across webui versions; upscaler extensions not loaded at runtime so their entries are missing from shared.sd_upscalers.

Related errors


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