Comfy-Org / Comfy-Org/ComfyUI

NaN causes workflows not to load from PNG

Open
#6,915 3 comments 1 reaction 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Expected Behavior

Dragging files that have metadata onto the ComfyUI interface should load the embedded workflow.

### Actual Behavior

Occasionally I've run up against videos and PNGs that should load workflows but don't. I happened to have the developer console open when dragging in a PNG and saw that JSON.parse was rejecting it (see below). I pulled the metadata out of the PNG and put it through a JSON checker and it rejected the entries with a NaN value. These entries weren't strings, just NaN straight in the data. Using tweakpng I changed the NaN values to "NaN" and the workflow loads. PNGs generated with the loaded workflow do not generate the same problem. I have included a "broken" file that won't load and a "corrected" file that will.

### Steps to Reproduce

I don't know how to reproduce it as it's something going on with the backend but both NaNs appeared to be tied to is_changed.

![Image](https://github.com/user-attachments/assets/9ec5e277-b7a7-44a4-9403-c43f834ab2b2)

![Image](https://github.com/user-attachments/assets/629cf6f2-2dfc-4e18-b6cb-30d3eec3d4c7)

### Debug Logs

```powershell
Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 2768 of the JSON data
handleFile http://127.0.0.1:8188/assets/index-Bv0b06LE.js:209616
handleFile http://127.0.0.1:8188/extensions/comfyui-videohelpersuite/js/videoinfo.js:101
handleFile http://127.0.0.1:8188/extensions/ComfyUI-Manager/components-manager.js:705
handleFile http://127.0.0.1:8188/extensions/comfyui-custom-scripts/js/workflows.js:212
handleFile http://127.0.0.1:8188/extensions/comfyui-custom-scripts/js/workflowImage.js:417
addDropHandler http://127.0.0.1:8188/assets/index-Bv0b06LE.js:208784
#addDropHandler http://127.0.0.1:8188/assets/index-Bv0b06LE.js:208775
setup http://127.0.0.1:8188/assets/index-Bv0b06LE.js:209078
setup http://127.0.0.1:8188/assets/GraphView-B_UDZi95.js:2915
createHook http://127.0.0.1:8188/assets/index-Bv0b06LE.js:37257
callWithErrorHandling http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34572
callWithAsyncErrorHandling http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34580
__weh http://127.0.0.1:8188/assets/index-Bv0b06LE.js:37236
flushPostFlushCbs http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34767
flushJobs http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34810
promise callback*queueFlush http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34701
queuePostFlushCb http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34716
queueEffectWithSuspense http://127.0.0.1:8188/assets/index-Bv0b06LE.js:41835
scheduler http://127.0.0.1:8188/assets/index-Bv0b06LE.js:40695
scheduler http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34304
trigger http://127.0.0.1:8188/assets/index-Bv0b06LE.js:32686
endBatch http://127.0.0.1:8188/assets/index-Bv0b06LE.js:32746
notify http://127.0.0.1:8188/assets/index-Bv0b06LE.js:33039
trigger http://127.0.0.1:8188/assets/index-Bv0b06LE.js:33013
set value http://127.0.0.1:8188/assets/index-Bv0b06LE.js:33939
finalizeNavigation http://127.0.0.1:8188/assets/index-Bv0b06LE.js:52863
pushWithRedirect http://127.0.0.1:8188/assets/index-Bv0b06LE.js:52768
promise callback*pushWithRedirect http://127.0.0.1:8188/assets/index-Bv0b06LE.js:52742
push2 http://127.0.0.1:8188/assets/index-Bv0b06LE.js:52665
install http://127.0.0.1:8188/assets/index-Bv0b06LE.js:53026
use http://127.0.0.1:8188/assets/index-Bv0b06LE.js:38328
http://127.0.0.1:8188/assets/index-Bv0b06LE.js:220732
index-Bv0b06LE.js:209616:31
handleFile http://127.0.0.1:8188/extensions/comfyui-videohelpersuite/js/videoinfo.js:101
AsyncFunctionThrow self-hosted:804
(Async: async)
handleFile http://127.0.0.1:8188/extensions/ComfyUI-Manager/components-manager.js:705
handleFile http://127.0.0.1:8188/extensions/comfyui-custom-scripts/js/workflows.js:212
handleFile http://127.0.0.1:8188/extensions/comfyui-custom-scripts/js/workflowImage.js:417
addDropHandler http://127.0.0.1:8188/assets/index-Bv0b06LE.js:208784
(Async: EventListener.handleEvent)
#addDropHandler http://127.0.0.1:8188/assets/index-Bv0b06LE.js:208775
setup http://127.0.0.1:8188/assets/index-Bv0b06LE.js:209078
InterpretGeneratorResume self-hosted:1413
AsyncFunctionNext self-hosted:800
(Async: async)
setup http://127.0.0.1:8188/assets/GraphView-B_UDZi95.js:2915
InterpretGeneratorResume self-hosted:1413
AsyncFunctionNext self-hosted:800
(Async: async)
createHook http://127.0.0.1:8188/assets/index-Bv0b06LE.js:37257
callWithErrorHandling http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34572
callWithAsyncErrorHandling http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34580
__weh http://127.0.0.1:8188/assets/index-Bv0b06LE.js:37236
flushPostFlushCbs http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34767
flushJobs http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34810
(Async: promise callback)
queueFlush http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34701
queuePostFlushCb http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34716
queueEffectWithSuspense http://127.0.0.1:8188/assets/index-Bv0b06LE.js:41835
scheduler http://127.0.0.1:8188/assets/index-Bv0b06LE.js:40695
scheduler http://127.0.0.1:8188/assets/index-Bv0b06LE.js:34304
trigger http://127.0.0.1:8188/assets/index-Bv0b06LE.js:32686
endBatch http://127.0.0.1:8188/assets/index-Bv0b06LE.js:32746
notify http://127.0.0.1:8188/assets/index-Bv0b06LE.js:33039
trigger http://127.0.0.1:8188/assets/index-Bv0b06LE.js:33013
set value http://127.0.0.1:8188/assets/index-Bv0b06LE.js:33939
finalizeNavigation http://127.0.0.1:8188/assets/index-Bv0b06LE.js:52863
pushWithRedirect http://127.0.0.1:8188/assets/index-Bv0b06LE.js:52768
(Async: promise callback)
pushWithRedirect http://127.0.0.1:8188/assets/index-Bv0b06LE.js:52742
push2 http://127.0.0.1:8188/assets/index-Bv0b06LE.js:52665
install http://127.0.0.1:8188/assets/index-Bv0b06LE.js:53026
use http://127.0.0.1:8188/assets/index-Bv0b06LE.js:38328
http://127.0.0.1:8188/assets/index-Bv0b06LE.js:220732
```

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.