AUTOMATIC1111/stable-diffusion-webui · error · FileNotFoundError
DAT data missing: {scaler.local_data_path}
Error message
DAT data missing: {scaler.local_data_path} What it means
FileNotFoundError raised by DatUpscaler.load_model after the scaler's URL was (or was not) downloaded via load_file_from_url but scaler.local_data_path still does not exist on disk. DAT models ship as .pth URLs on GitHub; when the download fails silently or writes elsewhere, the os.path.exists check trips before the scaler is returned.
Source
Thrown at modules/dat_model.py:54
expected_architecture="DAT",
)
return upscale_with_model(
model_descriptor,
img,
tile_size=opts.DAT_tile,
tile_overlap=opts.DAT_tile_overlap,
)
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"DAT data missing: {scaler.local_data_path}")
return scaler
raise ValueError(f"Unable to find model info: {path}")
def get_dat_models(scaler):
return [
UpscalerData(
name="DAT x2",
path="https://github.com/n0kovo/dat_upscaler_models/raw/main/DAT/DAT_x2.pth",
scale=2,
upscaler=scaler,
),
UpscalerData(
name="DAT x3",
path="https://github.com/n0kovo/dat_upscaler_models/raw/main/DAT/DAT_x3.pth",
scale=3,
upscaler=scaler,
),View on GitHub (pinned to 82a973c043)
Solutions
- Manually download the required DAT_x{2,3,4}.pth from the GitHub repo and place it in models/DAT/
- Verify models/DAT exists and is writable; remove partial files then retry so load_file_from_url re-downloads
- Check the server can reach github.com (proxy env vars HTTP(S)_PROXY set for the webui process)
Example fix
# before: selecting DAT x2 in Extras -> FileNotFoundError # after mkdir -p models/DAT curl -L -o models/DAT/DAT_x2.pth https://github.com/n0kovo/dat_upscaler_models/raw/main/DAT/DAT_x2.pth
Defensive patterns
Strategy: validation
Validate before calling
import os
need = {'DAT x2':'DAT_x2.pth','DAT x3':'DAT_x3.pth','DAT x4':'DAT_x4.pth'}
missing = [f for f in need.values() if not os.path.isfile(os.path.join('models','DAT',f))]
if missing:
raise FileNotFoundError(f'DAT weights missing: {missing}; download into models/DAT/') Type guard
def dat_weights_present(name: str, dat_dir='models/DAT') -> bool:
return os.path.isfile(os.path.join(dat_dir, f"DAT_x{name.split()[-1][1:]}.pth")) Try / catch
try:
scaler.load_model(path)
except FileNotFoundError as e:
if 'DAT data missing' in str(e):
download_dat_weights(path); return scaler.load_model(path)
raise Prevention
- Vendor DAT .pth files into the deployment instead of relying on runtime download
- Verify write permission on models/DAT
- Monitor first-run downloads in connected environments
When it happens
Trigger: Selecting the DAT upscaler in Extras while models/DAT/DAT_x2.pth (or x3/x4) is missing because the HTTPS download from github.com/n0kovo/dat_upscaler_models was blocked/failed; model dir redirected (custom --dat-models-path mismatch); file deleted between listing and load; partial download that saved to a temp name.
Common situations: Offline or China-region deployments where raw.githubusercontent/github downloads stall; interrupted first use leaving a corrupted cache entry; permission errors on the models directory so the file is never written.
Related errors
- No codeformer model found
- Unable to find model info: {path}
- Lora layer {self.network_key} matched a layer with unsupport
- Could not find a module type (out of {', '.join([x.__class__
- Script '{name}' not found
AI-assisted analysis of AUTOMATIC1111/stable-diffusion-webui@82a973c043 (2026-08-14).
Data as JSON: /api/errors/a1d0b6f8ab9fddb1.
Report an issue: GitHub.