-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Description
Is there an existing issue for this?
- I have searched the existing issues
OS
Linux
GPU
cuda
VRAM
16
What happened?
If a corrupted or unreadable image file exists in the output directory, the web UI stops loading and displays "Error" in red at the top right. This happens when the gallery pane attempts to load. The following stack trace is printed:
Traceback (most recent call last):
File "/opt/conda/envs/invokeai/lib/python3.10/site-packages/PIL/ImageFile.py", line 239, in load
s = read(self.decodermaxblock)
File "/opt/conda/envs/invokeai/lib/python3.10/site-packages/PIL/PngImagePlugin.py", line 932, in load_read
cid, pos, length = self.png.read()
File "/opt/conda/envs/invokeai/lib/python3.10/site-packages/PIL/PngImagePlugin.py", line 177, in read
length = i32(s)
File "/opt/conda/envs/invokeai/lib/python3.10/site-packages/PIL/_binary.py", line 85, in i32be
return unpack_from(">I", c, o)[0]
struct.error: unpack_from requires a buffer of at least 4 bytes for unpacking 4 bytes at offset 0 (actual buffer size is 0)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/invokeai/backend/invoke_ai_web_server.py", line 270, in handle_request_images
metadata = retrieve_metadata(path)
File "/invokeai/ldm/invoke/pngwriter.py", line 60, in retrieve_metadata
md = im.text.get('sd-metadata', '{}')
File "/opt/conda/envs/invokeai/lib/python3.10/site-packages/PIL/PngImagePlugin.py", line 787, in text
self.load()
File "/opt/conda/envs/invokeai/lib/python3.10/site-packages/PIL/ImageFile.py", line 245, in load
raise OSError("image file is truncated") from e
OSError: image file is truncated
Stack trace does not indicate which image file is problematic, which means the entire output dir needs to be discarded (or other tedious measures taken to locate it and delete).
The program does not crash, web UI loads fine once the offending file has been deleted, without the need to restart the main script.
Screenshots
No response
Additional context
No response
Contact Details
discord: brodsky