ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

VAE is not JSON serializable - inconstant error that causes loop.run_until_complete to end.

Open toxicwind opened this issue 1 year ago • 1 comments

Been getting this in the past few days with lcm sampler, attached workflow, didnt have time to look at it myself, but thought id log it: workflow(15).json workflow attached as well.

Traceback (most recent call last):
  File "D:\sd\ComfyUI\main.py", line 224, in <module>
    loop.run_until_complete(run(server, address=args.listen, port=args.port, verbose=not args.dont_print_server, call_on_start=call_on_start))
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\asyncio\base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "D:\sd\ComfyUI\main.py", line 128, in run
    await asyncio.gather(server.start(address, port, verbose, call_on_start), server.publish_loop())
  File "D:\sd\ComfyUI\server.py", line 611, in publish_loop
    await self.send(*msg)
  File "D:\sd\ComfyUI\server.py", line 548, in send
    await self.send_json(event, data, sid)
  File "D:\sd\ComfyUI\server.py", line 599, in send_json
    await send_socket_catch_exception(self.sockets[sid].send_json, message)
  File "D:\sd\ComfyUI\server.py", line 40, in send_socket_catch_exception
    await function(message)
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\site-packages\aiohttp\web_ws.py", line 352, in send_json
    await self.send_str(dumps(data), compress=compress)
                        ^^^^^^^^^^^
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\json\__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\json\encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\json\encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\json\encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type VAE is not JSON serializable

toxicwind avatar Jan 01 '24 19:01 toxicwind

    async def publish_loop(self):
        while True:
            try:
                try:
                    msg = await asyncio.wait_for(self.messages.get(), timeout=60)
                except asyncio.TimeoutError:
                    print("Queue idle for 60 seconds. Loop is still active.")
                    continue
                try:
                    await self.send(*msg)
                except Exception as e:
                    print(f"Error during message processing: {e}")
            except Exception as e:
                print(f"Unexpected error in publish_loop: {e}")

I've added this for the time being to try to track this down for ya.

toxicwind avatar Jan 01 '24 19:01 toxicwind

ERROR:root:!!! Exception during processing !!!
ERROR:root:Traceback (most recent call last):
  File "D:\sd\ComfyUI\execution.py", line 154, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\sd\ComfyUI\execution.py", line 84, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\sd\ComfyUI\execution.py", line 77, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\sd\ComfyUI\nodes.py", line 1371, in save_images
    metadata.add_text(x, json.dumps(extra_pnginfo[x]))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\json\__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\json\encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\json\encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "C:\Users\toxic\mambaforge\envs\py311-comfyui\Lib\json\encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type VAE is not JSON serializable

Seems the deeper message is a problem with metadata.

toxicwind avatar Jan 02 '24 18:01 toxicwind