Extensions/ComfyUI DIN Model Path Resolver
ComfyUI Extension

ComfyUI DIN Model Path Resolver

ComfyUI extension that repairs moved model paths by finding exact filenames across registered model directories.

By DIN-ComfyTools·Created about 17 hours ago·Updated about 17 hours ago· 0
DIN-ComfyTools/ComfyUI-DIN-Model-Path-Resolver
Nodes—
On cloudLocal install
Stars0
Updatedabout 17 hours ago
Readme

ComfyUI-DIN-Model-Path-Resolver

A ComfyUI extension for finding model files referenced by a workflow after the model has been moved.

Current behavior

  • For every known model category (LoRA, VAE, text_encoders, checkpoints, diffusion_models/UNET, etc.), DIN-MPR recursively scans that category's registered physical directories and every subdirectory for an exact filename.

  • This disk scan includes roots added through extra_model_paths.yaml.

  • Ignores ordinary non-model combo values such as video/h264-mp4.

  • Only recognized model filename extensions are scanned.

  • Uses exact filenames only. No fuzzy filename substitutions.

  • If one exact filename exists in the expected ComfyUI model group, DIN-MPR offers it.

  • If more than one exact filename exists, DIN-MPR shows a dropdown containing every exact match.

  • If the model group cannot be identified, DIN-MPR searches all registered ComfyUI model groups.

  • Diagnostics show node class, widget, requested filename, detected/internal model group, search method, and all registered model groups checked.

Automatic resolution

DIN-MPR now treats deterministic matches as repairs, not questions:

  • One exact match in the correct model category: applied automatically.
  • After the automatic change, DIN-MPR triggers the widget callback, node.onWidgetChanged, graph redraw/change notifications, and clears stale transient node error flags before re-scanning.
  • If all missing paths are resolved automatically, the resolver window never opens.
  • Two or more exact matches: the resolver opens with a dropdown. Pick the wanted copy and press Apply Selected.
  • No exact match: the resolver opens and provides Search Web, which opens a new browser tab searching for the exact filename.
  • After any Apply, DIN-MPR re-scans. When no unresolved/ambiguous items remain, the resolver closes automatically.

Reopening the resolver

You have three ways to bring the resolver back after closing it:

  1. Click the always-visible DIN-MPR button at the lower-right of ComfyUI.
  2. Press Ctrl+Shift+M.
  3. Use the DIN > DIN Model Path Resolver top-menu command on ComfyUI frontends that expose extension menu commands.

Opening the panel does not alter the workflow.

Re-scan Disk

Re-scan Disk performs a real model-directory refresh.

It clears:

  • DIN-MPR's internal model lists
  • ComfyUI's folder_paths.filename_list_cache
  • ComfyUI's temporary filename cache helper when available

The next scan calls ComfyUI's recursive model-directory search again.

You do not need to press R before using Re-scan Disk.

Example: if film_net_fp16.safetensors was missing, you copy/move it into a registered ComfyUI model directory while ComfyUI is running, then click Re-scan Disk. DIN-MPR will read the directories again and can immediately find it.

Installation

ComfyUI Manager

Search for ComfyUI DIN Model Path Resolver in ComfyUI Manager and select Install.

Manual installation

From the ComfyUI/custom_nodes directory:

git clone https://github.com/DIN-ComfyTools/ComfyUI-DIN-Model-Path-Resolver.git

Restart ComfyUI and hard-refresh the browser once (Ctrl+F5).

Console message:

[DIN-MPR] ComfyUI DIN Model Path Resolver loaded — Ctrl+Shift+M to reopen

Test

From the custom-node folder:

D:\AI7\ComfyUI\venv\Scripts\python.exe tests\run_tests.py

No third-party Python packages are required by DIN-MPR.

Native ComfyUI revalidation

DIN-MPR now uses ComfyUI's own app.refreshMissingModels() pipeline after repairing model paths.

That is materially different from merely changing a widget value or simulating a dropdown click. ComfyUI's native refresh pipeline reloads the current node definitions and re-runs its Missing Models scan against the corrected graph, so the native red error state and Missing Models panel are recalculated from the actual current paths.

Flow:

  1. DIN-MPR repairs every deterministic single exact match.
  2. DIN-MPR calls ComfyUI's native Missing Models refresh.
  3. DIN-MPR scans again for ambiguous/unresolved paths.
  4. If none remain, no DIN-MPR dialog is shown.

This avoids requiring a browser/workflow refresh just to clear stale missing model state.

Execution-error reset after automatic repair

ComfyUI has two different error systems involved here:

  1. the Missing Models store; and
  2. the execution/validation error store that paints a node red.

Refreshing Missing Models alone can leave the second store stale. That is why a corrected workflow could still show a red Error node until it was saved and reopened.

After deterministic path repairs, DIN-MPR now serializes the already-corrected live graph and asks ComfyUI to reload that graph in-place with loadGraphData(..., clean=true). ComfyUI's own clean/load path resets its execution-error store and rebuilds validation from the corrected values.

This is not a browser refresh and does not read the workflow back from disk. DIN-MPR preserves the current canvas view and attempts to restore the current node selection. It is effectively the same internal validation reset that made save/reopen clear the stale red state, but automatic and invisible.

Re-scan Disk now includes ComfyUI's R refresh

The Re-scan Disk button now performs the sequence:

  1. Execute ComfyUI's core Comfy.RefreshNodeDefinitions command — the exact command bound to the R key / Edit > Refresh Node Definitions.
  2. Wait 1.25 seconds for ComfyUI's node/model refresh to finish.
  3. Clear DIN-MPR's resolver cache and ComfyUI's backend filename-list cache.
  4. Re-scan the workflow and model directories.
  5. Automatically apply deterministic single exact matches and run the existing in-place validation reset.

This is intended for the case where a missing model is copied into its correct directory while ComfyUI is already running. You should no longer need to press R manually before or after Re-scan Disk.

Ambiguous-match selection history

When more than one exact filename match exists, DIN-MPR shows the candidate dropdown. After Apply Selected:

  • the resolved line item disappears immediately;
  • if it was the last active issue, the resolver window closes immediately;
  • the choice is retained for the current ComfyUI session under Previous ambiguous choices.

Reopen DIN-MPR with the lower-right button or Ctrl+Shift+M. The history entry lets you choose another exact match with Apply Choice, or press Undo to restore the value that existed before the selection. Choice history is session-only and is not written into the workflow.

Separator-equivalent filenames and misplaced-model discovery

DIN-MPR now keeps exact filenames as the first priority, then allows hyphen - and underscore _ to be interchangeable separators. For example, minimax_h3_fl2va_int8_convrot.safetensors can match minimax-h3-fl2va-int8_convrot.safetensors. No other characters are ignored or fuzzed.

If a model is not found anywhere in its expected category tree (LoRA, VAE, text_encoders, etc.), DIN-MPR searches all registered model directories and the main ComfyUI models tree recursively. If it finds the file in the wrong category, it does not silently apply that wrong path. It reports the actual folder and provides Copy Found Folder so the path can be pasted directly into Windows Explorer.

The old universal Copy Paths button has been removed. Every unresolved/misplaced row now has its own Copy Missing Path button, so there is no ambiguity about which item is being copied.