Fresh Install "SaveImage not enough values to unpack (expected 5, got 0
- Dominant language
- Python
- Stars
- 133k
- Forks
- 15.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 158
Description
I just installed ComfyUI by pulling the git repo and following the installation instructions... I am pointing it at an InvokeUI install to pick up models (see config below)
ComfyUI "works" and generates an image (I added a preview node to see it), but the SaveImage throwing a non-sensical error. The error occurs because it is picking up an output directory from somewhere mysterious (I didn't tell it this output directory. it looks like a config from some other image gen setup), and putting it into the SaveImage node `filename_prefix` by default.. Then, the way the ComfyUI file path checking code signals this error is just "return {}" which then throws a nonsensical tuple unpack error...
As I see it, the fixable problems are:
1. The invalid output directory error is a nonsensical exception "`not enough values to unpack (expected 5, got 0)`" because `get_save_image_path()` is doing "`return {}`" as an error condition at [folder_paths.py:230](https://github.com/comfyanonymous/ComfyUI/blob/39e75862b248a20e8233ccee743ba5b2e977cdcf/folder_paths.py#L232). This is easily fixed by changing the output directory checking error signal code to:
```
if os.path.commonpath((output_dir, os.path.abspath(full_output_folder))) != output_dir:
err = "**** ERROR: Saving image outside the output folder is not allowed." + \
"\n full_output_folder: " + os.path.abspath(full_output_folder) + \
"\n output_dir: " + output_dir + \
"\n commonpath: " + os.path.commonpath((output_dir, os.path.abspath(full_output_folder)))
print(err)
raise Exception(err)
```
2. Comfy does not listen to an "output_dir: " specification in the yaml config file. Seems like it should.
3. Where is Comfy UI mysteriosuly picking up this default save-image prefix from? Seems like it shouldnt.
```
Error occurred when executing SaveImage:
not enough values to unpack (expected 5, got 0)
File "D:\ComfyUI\ComfyUI\execution.py", line 153, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "D:\ComfyUI\ComfyUI\execution.py", line 83, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "D:\ComfyUI\ComfyUI\execution.py", line 76, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "D:\ComfyUI\ComfyUI\nodes.py", line 1358, in save_images
full_output_folder, filename, counter, subfolder, filename_prefix = folder_paths.get_save_image_path(filename_prefix, self.output_dir, images[0].shape[1], images[0].shape[0])
```


I am using a simple config that points it to my InvokeAI Models:
InvokeAI:
base_path: D:/InvokeAI/
checkpoints: models/sd-1/main
vae: models/sd-1/vae
loras: models/sd-1/lora
embeddings: models/sd-1/embedding
controlnet: models/sd-1/controlnet
comfyui:
base_path: D:/ComfyUI/ComfyUI/
output_dir: D:/AI_Output/ComfyUI/ # <---- this is ignored
Contributor guide
Assessment
This issue has not been assessed yet.