{"record":{"id":"f2be35f91cd7b91c","repo":"AUTOMATIC1111/stable-diffusion-webui","slug":"could-not-find-upscaler-named-self-hr-upscaler","errorCode":null,"errorMessage":"could not find upscaler named {self.hr_upscaler}","messagePattern":"could not find upscaler named (.+?)","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"modules/processing.py","lineNumber":1286,"sourceCode":"                hr_prompt = p.all_hr_prompts[index]\r\n                return hr_prompt if hr_prompt != prompt_text else None\r\n\r\n            def get_hr_negative_prompt(p, index, negative_prompt, **kwargs):\r\n                hr_negative_prompt = p.all_hr_negative_prompts[index]\r\n                return hr_negative_prompt if hr_negative_prompt != negative_prompt else None\r\n\r\n            self.extra_generation_params[\"Hires prompt\"] = get_hr_prompt\r\n            self.extra_generation_params[\"Hires negative prompt\"] = get_hr_negative_prompt\r\n\r\n            self.extra_generation_params[\"Hires schedule type\"] = None  # to be set in sd_samplers_kdiffusion.py\r\n\r\n            if self.hr_scheduler is None:\r\n                self.hr_scheduler = self.scheduler\r\n\r\n            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\")\r\n            if self.enable_hr and self.latent_scale_mode is None:\r\n                if not any(x.name == self.hr_upscaler for x in shared.sd_upscalers):\r\n                    raise Exception(f\"could not find upscaler named {self.hr_upscaler}\")\r\n\r\n            self.calculate_target_resolution()\r\n\r\n            if not state.processing_has_refined_job_count:\r\n                if state.job_count == -1:\r\n                    state.job_count = self.n_iter\r\n                if getattr(self, 'txt2img_upscale', False):\r\n                    total_steps = (self.hr_second_pass_steps or self.steps) * state.job_count\r\n                else:\r\n                    total_steps = (self.steps + (self.hr_second_pass_steps or self.steps)) * state.job_count\r\n                shared.total_tqdm.updateTotal(total_steps)\r\n                state.job_count = state.job_count * 2\r\n                state.processing_has_refined_job_count = True\r\n\r\n            if self.hr_second_pass_steps:\r\n                self.extra_generation_params[\"Hires steps\"] = self.hr_second_pass_steps\r\n\r\n            if self.hr_upscaler is not None:\r","sourceCodeStart":1268,"sourceCodeEnd":1304,"githubUrl":"https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/82a973c04367123ae98bd9abdf80d9eda9b910e2/modules/processing.py#L1268-L1304","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use the exact upscaler name from the UI dropdown / shared.sd_upscalers (query sdapi/v1/upscalers to list valid names).","For latent-space upscaling use one of the latent mode strings ('Latent', 'Latent (nearest)', 'Latent (antialiased)', 'Latent (nearest-exact)', 'Latent (bicubic)').","If the upscaler comes from an extension, ensure the extension is enabled and its model files are present so it registers at startup."],"exampleFix":"# before\npayload['hr_upscaler'] = 'REALESRGAN x4+'  # Exception\n\n# after\npayload['hr_upscaler'] = 'R-ESRGAN 4x+'    # exact registered name","handlingStrategy":"validation","validationCode":"import modules.shared as shared\n\ndef valid_hr_upscaler(name):\n    if name in shared.latent_upscale_modes:\n        return True\n    return any(x.name == name for x in shared.sd_upscalers)\n\nif not valid_hr_upscaler(payload['hr_upscaler']):\n    payload['hr_upscaler'] = 'Latent'  # or pick from shared.sd_upscalers names","typeGuard":"def is_known_upscaler(name: str) -> bool:\n    return name in shared.latent_upscale_modes or any(u.name == name for u in shared.sd_upscalers)","tryCatchPattern":"try:\n    processed = process_images(p)\nexcept Exception as e:\n    if 'could not find upscaler' in str(e):\n        p.hr_upscaler = 'Latent'\n        processed = process_images(p)\n    else:\n        raise","preventionTips":["Fetch valid names from the API (/sdapi/v1/upscalers) instead of hard-coding strings.","Re-validate upscaler names after extension installs/upgrades change the registry."],"tags":["hires-fix","upscaler","processing","validation"],"backgroundTag":null,"analyzedSha":"82a973c04367123ae98bd9abdf80d9eda9b910e2","analyzedAt":"2026-08-14T16:46:43.225Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}