Comfy-Org / Comfy-Org/ComfyUI

KeyError in cache_update

Open
#10,402 26 comments 1 reaction 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

### Custom Node Testing

- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

no errors

### Actual Behavior

I started to recently get following errors randomly after upgrading to the latest comfyui
```
self._target(*self._args, **self._kwargs)

File "/root/comfy/ComfyUI/main.py", line 195, in prompt_worker

e.execute(item[2], prompt_id, item[3], item[4])

File "/root/comfy/ComfyUI/execution.py", line 655, in execute

asyncio.run(self.execute_async(prompt, prompt_id, extra_data, execute_outputs))

File "/opt/conda/lib/python3.11/asyncio/runners.py", line 190, in run

return runner.run(main)

^^^^^^^^^^^^^^^^

File "/opt/conda/lib/python3.11/asyncio/runners.py", line 118, in run

return self._loop.run_until_complete(task)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/opt/conda/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete

return future.result()

^^^^^^^^^^^^^^^

File "/root/comfy/ComfyUI/execution.py", line 701, in execute_async

result, error, ex = await execute(self.server, dynamic_prompt, self.caches, node_id, extra_data, executed, prompt_id, execution_list, pending_subgraph_results, pending_async_nodes)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/root/comfy/ComfyUI/execution.py", line 409, in execute

execution_list.cache_update(unique_id, caches.outputs.get(unique_id))

File "/root/comfy/ComfyUI/comfy_execution/graph.py", line 220, in cache_update

self.execution_cache[to_node_id][node_id] = value

~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^

KeyError: '7'
```

I saw the code in the error is from some very recent commit, that might have introduced some bug?

### Steps to Reproduce

it happens randomly not really sure how to reproduce consistently

### Debug Logs

```powershell
provided above
```

### 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.