Feature Request: Automatically Resolve Models by Filename When They Exist in Subfolders
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 155
Description
### Feature Idea
Summary
When opening a workflow, if a referenced model path no longer exists, ComfyUI should automatically search the corresponding model directory recursively for a file with the same filename. If a unique match is found, it should be loaded automatically.
Motivation
Many users organize their models into subfolders to keep large model libraries manageable. For example:
models/
├── checkpoints/
│ ├── Anime/
│ ├── Realistic/
│ ├── Flux/
│ └── Wan/
├── loras/
├── vae/
├── controlnet/
└── ...
Although ComfyUI correctly indexes models in subfolders, workflows store the relative path to the model rather than just its filename.
This means that if two users organize their model libraries differently, opening a shared workflow frequently results in multiple "missing model" entries even though all required models are already present somewhere under the correct model directory.
The user must then manually reselect each model, which becomes tedious for larger workflows.
Example
Workflow references:
models/checkpoints/pony_v7.safetensors
Local installation:
models/checkpoints/Anime/Pony/pony_v7.safetensors
The model exists and has already been indexed by ComfyUI, but it is still reported as missing because the stored relative path does not match.
Proposed Behavior
When loading a workflow:
Attempt to load the stored relative path (current behavior).
If the path does not exist:
Search recursively within the corresponding model type directory (checkpoints, loras, vae, controlnet, etc.).
If exactly one file with the same filename is found:
Automatically resolve and load that model.
If multiple matches are found:
Preserve the current behavior (or optionally allow the user to choose which one to use).
Benefits
Makes workflows significantly more portable between users.
Removes repetitive manual model selection.
Encourages better model organization without reducing compatibility.
Helps users with large model collections.
Requires no changes for users who already keep identical folder structures.
Possible Implementation
This feature would only be triggered when the stored path cannot be found, so it would not affect normal workflow loading.
To avoid repeated directory scans, resolved paths could optionally be cached for future workflow loads.
Backward Compatibility
This feature is fully backward compatible because:
Existing workflows continue to work unchanged.
Current behavior remains the fallback if no unique filename match is found.
It could also be implemented as an optional setting for users who prefer the current behavior.
I believe this would substantially improve the experience of sharing workflows across different machines while allowing users to organize their model libraries in whatever folder structure works best for them.
### Existing Solutions
_No response_
### Other
_No response_
Contributor guide
Research direction
Start at workflow loading and the model path resolution logic, then trace how model directories such as checkpoints, loras, vae, and controlnet are indexed. Verify the missing-path fallback and define how recursive filename matches are handled. Done means a unique matching file resolves automatically, while missing or duplicate matches retain current behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100