`FileNotFoundError` for `custom_nodes` directory at startup (should be created instead of bailing)
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
### Expected Behavior
ComfyUI should attempt to ~~create the directory it wants~~ skip checking the implicit `custom_nodes/` dir when it is missing, rather than bail at startup.
Outdated
ComfyUI startup already handles creating other data directories when they're missing:
https://github.com/comfyanonymous/ComfyUI/blob/98ff01e1486353a3b0ddd8fa82fcbb25401f8364/folder_paths.py#L49-L52
**`input/` directory:**
https://github.com/comfyanonymous/ComfyUI/blob/98ff01e1486353a3b0ddd8fa82fcbb25401f8364/folder_paths.py#L96-L100
**`output/` directory:** (_created later on-demand_)
https://github.com/comfyanonymous/ComfyUI/blob/98ff01e1486353a3b0ddd8fa82fcbb25401f8364/folder_paths.py#L393-L394
**`user/` directory:**
https://github.com/comfyanonymous/ComfyUI/blob/98ff01e1486353a3b0ddd8fa82fcbb25401f8364/app/user_manager.py#L33-L39
**`temp/` directory:**
https://github.com/comfyanonymous/ComfyUI/blob/f3ff5c40db3b68449b47112591eef31094cffe70/main.py#L286
---
Similar logic could be used to create a `custom_nodes/` directory instead of failing?
https://github.com/comfyanonymous/ComfyUI/blob/98ff01e1486353a3b0ddd8fa82fcbb25401f8364/folder_paths.py#L41
https://github.com/comfyanonymous/ComfyUI/blob/98ff01e1486353a3b0ddd8fa82fcbb25401f8364/main.py#L73-L75
### Actual Behavior
When running ComfyUI with an empty data directory (_such as when first using the `--base-directory` arg_), during ComfyUI startup directories will be created as needed, all except for `custom_nodes` which raises an exception instead of ~~also creating~~ skipping that directory:
```
Traceback (most recent call last):
File "/opt/comfyui/app/main.py", line 99, in
execute_prestartup_script()
File "/opt/comfyui/app/main.py", line 75, in execute_prestartup_script
possible_modules = os.listdir(custom_node_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/comfyui/data/custom_nodes'
```
### Steps to Reproduce
Run ComfyUI with `--base-directory` arg pointing to an empty directory.
### Debug Logs
```powershell
Traceback (most recent call last):
File "/opt/comfyui/app/main.py", line 99, in
execute_prestartup_script()
File "/opt/comfyui/app/main.py", line 75, in execute_prestartup_script
possible_modules = os.listdir(custom_node_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/opt/comfyui/data/custom_nodes'
```
Contributor guide
Assessment
This issue has not been assessed yet.