lllyasviel / stable-diffusion-webui-forge

GNU Affero General Public License v3.0
8.55k stars 838 forks source link

Manual Hires Fix gives error when saving: OSError: [Errno 22] Invalid argument #2326

Closed Diamond-Shark-art closed 6 days ago

Diamond-Shark-art commented 1 week ago

When clicking the hires fix icon in txt2img (below the image), it gives this error: OSError: [Errno 22] Invalid argument.

The full message is this:

Traceback (most recent call last):
  File "C:\Users\Gebruiker\Desktop\Stable Diffusion\Forge\stable-diffusion-webui-forge\modules_forge\main_thread.py", line 30, in work
    self.result = self.func(*self.args, **self.kwargs)
  File "C:\Users\Gebruiker\Desktop\Stable Diffusion\Forge\stable-diffusion-webui-forge\modules\txt2img.py", line 120, in txt2img_upscale_function
    return gr.Gallery(new_gallery, selected_index=new_index), json.dumps(geninfo), plaintext_to_html(processed.info), plaintext_to_html(processed.comments, classname="comments")
  File "C:\Users\Gebruiker\Desktop\Stable Diffusion\Forge\stable-diffusion-webui-forge\modules\gradio_extensions.py", line 147, in __repaired_init__
    original(self, *args, **fixed_kwargs)
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio\component_meta.py", line 163, in wrapper
    return fn(self, **kwargs)
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio\components\gallery.py", line 143, in __init__
    super().__init__(
  File "C:\Users\Gebruiker\Desktop\Stable Diffusion\Forge\stable-diffusion-webui-forge\modules\gradio_extensions.py", line 36, in IOComponent_init
    res = original_IOComponent_init(self, *args, **kwargs)
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio\component_meta.py", line 163, in wrapper
    return fn(self, **kwargs)
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio\components\base.py", line 217, in __init__
    self.value = move_files_to_cache(
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 416, in move_files_to_cache
    return client_utils.traverse(data, _move_to_cache, client_utils.is_file_obj)
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio_client\utils.py", line 984, in traverse
    new_obj.append(traverse(item, func, is_root))
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio_client\utils.py", line 979, in traverse
    new_obj[key] = traverse(value, func, is_root)
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio_client\utils.py", line 975, in traverse
    return func(json_obj)
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 392, in _move_to_cache
    temp_file_path = block.move_resource_to_block_cache(payload.path)
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 342, in move_resource_to_block_cache
    temp_file_path = processing_utils.save_file_to_cache(
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 250, in save_file_to_cache
    temp_dir = hash_file(file_path)
  File "C:\Users\Gebruiker\stable-diffusion-webui\venv\lib\site-packages\gradio\processing_utils.py", line 182, in hash_file
    with open(file_path, "rb") as f:
OSError: [Errno 22] Invalid argument: 'C:\\Users\\Gebruiker\\stable-diffusion-webui\\outputs\\txt2img-images\\2024-11-15\\20241115_153940.jpg?1731681580.565439'
[Errno 22] Invalid argument: 'C:\\Users\\Gebruiker\\stable-diffusion-webui\\outputs\\txt2img-images\\2024-11-15\\20241115_153940.jpg?1731681580.565439'

It successfully upscaled the image, i can manually move it to my saved folder.

DenOfEquity commented 1 week ago

Not sure why the new hires quickbutton code leads to that error, but handily I already had another patch ready that fixes it (which is why I didn't get this error when testing). Try again after update.

Diamond-Shark-art commented 6 days ago

Thank you! Works perfect again :).