rgthree-comfy icon indicating copy to clipboard operation
rgthree-comfy copied to clipboard

Error: 'VAE' object is not subscriptable if vae decode tiled connected to any switch

Open wasd-tech opened this issue 1 year ago • 11 comments

!!! Exception during processing !!! 'VAE' object is not subscriptable Traceback (most recent call last): File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/execution.py", line 496, in execute output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/execution.py", line 315, in get_output_data return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/custom_nodes/comfyui-lora-manager/py/metadata_collector/metadata_hook.py", line 165, in async_map_node_over_list_with_metadata results = await original_map_node_over_list( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/execution.py", line 289, in _async_map_node_over_list await process_inputs(input_dict, i) File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/execution.py", line 277, in process_inputs result = f(**inputs) ^^^^^^^^^^^ File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/nodes.py", line 1586, 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]) ~~~~~~^^^ TypeError: 'VAE' object is not subscriptable

Regular VAE decode works

wasd-tech avatar Sep 09 '25 12:09 wasd-tech

Same here, have a similar issue as well when using any switch to switch out models. I have different pipelines that uses different models within the same workflow, the models that get muted/bypassed causes issues with the any switch node

Apacchi88 avatar Sep 09 '25 14:09 Apacchi88

!!! Exception during processing !!! 'VAE' object is not subscriptable Traceback (most recent call last): File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/execution.py", line 496, in execute output_data, output_ui, has_subgraph, has_pending_tasks = await get_output_data(prompt_id, unique_id, obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/execution.py", line 315, in get_output_data return_values = await _async_map_node_over_list(prompt_id, unique_id, obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb, hidden_inputs=hidden_inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/custom_nodes/comfyui-lora-manager/py/metadata_collector/metadata_hook.py", line 165, in async_map_node_over_list_with_metadata results = await original_map_node_over_list( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/execution.py", line 289, in _async_map_node_over_list await process_inputs(input_dict, i) File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/execution.py", line 277, in process_inputs result = f(**inputs) ^^^^^^^^^^^ File "/home/USER/ROCm/Almalinux/SwarmUI/dlbackend/ComfyUI/nodes.py", line 1586, 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]) ~~~~~~^^^ TypeError: 'VAE' object is not subscriptable

Regular VAE decode works

For the issue that you have, what worked for me in the meantime was using another node that has a proper fallback/switch behavior specifically for images.

https://github.com/benstaniford/comfy-image-switch

Apacchi88 avatar Sep 09 '25 14:09 Apacchi88

@Apacchi88 thanks for the suggestion. I will try it later and see if it works. It's a big problem for me because I have an AMD card so I can only use the tiled version of VAE.

wasd-tech avatar Sep 09 '25 15:09 wasd-tech

+1 same issue. In my case it was latent_image switch for SamplerCustomAdvanced node. Probably related to this issue: https://github.com/rgthree/rgthree-comfy/issues/560

Apollo-Spec01 avatar Sep 11 '25 03:09 Apollo-Spec01

You can use

ComfyUI-Impact-Pack Switch (Any) replace as a substitute for a while, looking forward to fixing it.

LLAI-lab avatar Sep 13 '25 12:09 LLAI-lab

Can someone supply a bare-bones workflow of the issue. I can't seem to reproduce it, and I'm little surprised as the Any Switch does not do anything to the value passed through, so it wouldn't just break a VAE that is used as an input.

Note, as I've seen someone on reddit describe an issue: if you're bypassing a node connected to an Any Switch and expecting Any Switch to "skip" that input, that's not how it's meant to work; you should be muting that input node. It's possible bypassing worked at some point and ComfyUI changed/broke something with the way their bypassing works, but Any Switch is always meant to mute input nodes to skip them. Anyway, just mentioning that, it may not be related.

rgthree avatar Sep 13 '25 18:09 rgthree

@rgthree I use both bypass and mute, so maybe my problems are related to that. I will do more testing, as even changing the order of inputs in the switch makes a difference in my workflow.

wasd-tech avatar Sep 13 '25 19:09 wasd-tech

Reproduced the issue in a simple workflow. https://www.mediafire.com/file/p7rfvvtvc3u3rvq/bare-bones_workflow.json/file

Apollo-Spec01 avatar Sep 15 '25 00:09 Apollo-Spec01

In my case, the input is from a get node ComfyUI-KJNodes

When I disconnect the node physically, it works again.

The node sending data to that Get node is muted. It used to work for weeks. Suddenly it doesn't.

Image

alFrame avatar Sep 15 '25 17:09 alFrame

Thanks everyone. I was able to reproduce it finally; turns out I wasn't able to because I was using a newer frontend version to fix the same issue as this, though displayed through ComfyUI-KJNodes Get/SetNode. The good news is this is already fixed in ComfyUI_frontend through this bug ComfyUI_frontend/issues/5403 and this PR ComfyUI_frontend/pull/5431. The bad news is its only on frontend version v1.27.3 or newer, and not yet in the stable release.

You can use it now by forcing the frontend version using: --front-end-version Comfy-Org/[email protected] in your startup. (Note, if you use this, you'll want to remove it once the released version by default surpasses 1.27.3 or you'll be stuck on an old version at that point).

Also, just to note, all the examples here are bypassing. And there was a new comfyui bug mentioned above that incorrectly passed an input through to the Any Switch when it shouldn't have. However, I want to reiterate that in these cases you really should be muting those nodes, which is the way the Any Switch is really meant to operate. Mute and Bypass are not the same mechanism in the UI and if you're intention is to not choose an input in an Any Switch, then it should almost always be muted.

rgthree avatar Sep 16 '25 00:09 rgthree

Thanks everyone. I was able to reproduce it finally; turns out I wasn't able to because I was using a newer frontend version to fix the same issue as this, though displayed through ComfyUI-KJNodes Get/SetNode. The good news is this is already fixed in ComfyUI_frontend through this bug ComfyUI_frontend/issues/5403 and this PR ComfyUI_frontend/pull/5431. The bad news is its only on frontend version v1.27.3 or newer, and not yet in the stable release.

You can use it now by forcing the frontend version using: --front-end-version Comfy-Org/[email protected] in your startup. (Note, if you use this, you'll want to remove it once the released version by default surpasses 1.27.3 or you'll be stuck on an old version at that point).

Also, just to note, all the examples here are bypassing. And there was a new comfyui bug mentioned above that incorrectly passed an input through to the Any Switch when it shouldn't have. However, I want to reiterate that in these cases you really should be muting those nodes, which is the way the Any Switch is really meant to operate. Mute and Bypass are not the same mechanism in the UI and if you're intention is to not choose an input in an Any Switch, then it should almost always be muted.

worked here thanks

FFloriani avatar Sep 28 '25 19:09 FFloriani