Skip to content

For Loops don't work in latest ComfyUI in --cache-none mode #10329

@wallentri88

Description

@wallentri88

Custom Node Testing

Expected Behavior

For Loops work in --cache-none mode

Actual Behavior

Traceback (most recent call last):
  File "/home/.../ComfyUI/execution.py", line 548, in execute
    subcache = await cache.ensure_subcache_for(unique_id, new_node_ids)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/.../ComfyUI/comfy_execution/caching.py", line 423, in ensure_subcache_for
    self.ancestors[child_id].add(node_id)
    ~~~~~~~~~~~~~~^^^^^^^^^^
KeyError: '4.0.0.1'```

I tried to replace it on `setdefault`, but got index out of range error in other place

### Steps to Reproduce

Use any custom nodes which implement For Loops, for example from here, using this workflow (embedded): https://github.com/BadCafeCode/execution-inversion-demo-comfyui/blob/main/examples/SimpleForLoop.png

### Debug Logs

```powershell
!!! Exception during processing !!!

Other

using comfyui commit 4ffea0e

Metadata

Metadata

Assignees

No one assigned

    Labels

    Potential BugUser is reporting a bug. This should be tested.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions