From 77f7fc61bd0076a6fc3c4204016c491d3b8b7105 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 11 Jun 2026 08:15:35 +0000 Subject: [PATCH] Fix UnboundLocalError when resize gets an invalid upscaler name The invalid-upscaler warning referenced selected_upscaler, which is only assigned when a matching upscaler was found, so an unknown name (stale infotext, removed upscaler) crashed the resize instead of falling back to plain resampling. https: //claude.ai/code/session_014QWKWgKvMevcuvfCnsYoT2 Co-Authored-By: Claude --- modules/image/resize.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/image/resize.py b/modules/image/resize.py index 22841e6e5..53a64b80a 100644 --- a/modules/image/resize.py +++ b/modules/image/resize.py @@ -51,7 +51,7 @@ def resize_image(resize_mode: int, im: Image.Image | torch.Tensor, width: int, h else: im = selected_upscaler.scaler.upscale(im, scale, selected_upscaler.name) else: - log.warning(f"Resize upscaler: invalid={upscaler_name} fallback={selected_upscaler.name}") + log.warning(f"Resize upscaler: invalid={upscaler_name} fallback=resample") log.debug(f"Resize upscaler: available={[u.name for u in shared.sd_upscalers]}") if isinstance(im, Image.Image) and (im.width != w or im.height != h): # probably downsample after upscaler created larger image im = sharpfin.resize(im, (w, h))