AUTOMATIC1111/stable-diffusion-webui · error · FileNotFoundError

RealESRGAN data missing: {scaler.local_data_path}

Error message

RealESRGAN data missing: {scaler.local_data_path}

What it means

UpscalerRealESRGAN.load_model first downloads the scaler's data_path if it is a URL; then it requires scaler.local_data_path to exist on disk. If the file is still missing after download (failed download silently left no file, or a local path entry points nowhere), FileNotFoundError is raised.

Source

Thrown at modules/realesrgan_model.py:62

        )
        return upscale_with_model(
            model_descriptor,
            img,
            tile_size=opts.ESRGAN_tile,
            tile_overlap=opts.ESRGAN_tile_overlap,
            # TODO: `outscale`?
        )

    def load_model(self, path):
        for scaler in self.scalers:
            if scaler.data_path == path:
                if scaler.local_data_path.startswith("http"):
                    scaler.local_data_path = modelloader.load_file_from_url(
                        scaler.data_path,
                        model_dir=self.model_download_path,
                    )
                if not os.path.exists(scaler.local_data_path):
                    raise FileNotFoundError(f"RealESRGAN data missing: {scaler.local_data_path}")
                return scaler
        raise ValueError(f"Unable to find model info: {path}")


def get_realesrgan_models(scaler: UpscalerRealESRGAN):
    return [
        UpscalerData(
            name="R-ESRGAN General 4xV3",
            path="https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth",
            scale=4,
            upscaler=scaler,
        ),
        UpscalerData(
            name="R-ESRGAN General WDN 4xV3",
            path="https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-wdn-x4v3.pth",
            scale=4,
            upscaler=scaler,
        ),

View on GitHub (pinned to 82a973c043)

Solutions

  1. Manually place the RealESRGAN weights (e.g. realesr-general-x4v3.pth, RealESRGAN_x4plus.pth) into models/RealESRGAN with the expected filename.
  2. Check network access to github.com releases (or set HTTPS_PROXY) and retry so load_file_from_url completes.
  3. Verify the expected local_data_path in the error message and make sure that directory exists and is writable.

Example fix

# shell: place the weight file the scaler expects
mkdir -p models/RealESRGAN
curl -L -o models/RealESRGAN/RealESRGAN_x4plus.pth \
  https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth
Defensive patterns

Strategy: validation

Validate before calling

import os

def realesrgan_ready(scaler):
    if scaler.local_data_path.startswith('http'):
        return True  # will be downloaded; ensure network instead
    return os.path.exists(scaler.local_data_path)

for s in upscaler.scalers:
    if s.data_path == wanted and not realesrgan_ready(s):
        raise SystemExit('RealESRGAN weights missing; download them into models/RealESRGAN')

Try / catch

try:
    scaler = upscaler.load_model(path)
except FileNotFoundError as e:
    # weights failed to appear after download attempt; fetch manually then retry once
    download_realesrgan_weights(expected_local_path)
    scaler = upscaler.load_model(path)

Prevention

When it happens

Trigger: Selecting a RealESRGAN upscaler whose .pth weights: (a) failed to download from GitHub (offline, blocked, proxy), or (b) were configured with a local path that does not exist.

Common situations: First use of 'R-ESRGAN 4x+' on machines without GitHub access; partial download left zero-byte/deleted file; models/RealESRGAN directory moved or on an unmounted volume.

Related errors


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