Skip to content

Comfy-cli crash at end of execution but not comfyui #278

@BowgartField

Description

@BowgartField

Hi,
I'm executing my workflow api json file like this:
comfy run --workflow workflow.json --wait --timeout 3600 --verbose
The execution is started whiteout any problem.
But at the end of the execution, comfy-cli is crashing with error:
KeyError: '406.0.0.428'

Which seems to be 2 nodes id: 406 and 428.
But in the logs of comfy-ui everything went well.
I can see the log "Prompt executed in XXXs". Which for me means that everything went well, as I can't see any error in comfy-ui logs.
Plus my images are saved correctly, and save image are the last nodes of the workflow.

406 and 428 node are coming from:
https://github.com/WainWong/ComfyUI-Loop-image.

comfyui: 0.3.39 (tried also on 0.3.29)
comfy-cli: latest
python: 3.10

comfy-ui install command:
comfy --skip-prompt --no-enable-telemetry --workspace /comfyui install --fast-deps --nvidia --version 0.3.39

root@runc:/mnt/code# comfy run --workflow workflow.json --wait --timeout 3600 --verbose
Executing workflow: /mnt/code/workflow.json
XXXXX
....
Executing : Batch Image Loop Open🐰 - CyberEve_BatchImageLoopOpen (428)
....
Executing : Batch Image Loop Close🐰 - CyberEve_BatchImageLoopClose (406)
━━━━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━  68% 0:02:50
╭─────────────────────────────────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ /usr/local/lib/python3.10/site-packages/comfy_cli/tracking.py:77 in wrapper                                                                                                                                                                     │
│                                                                                                                                                                                                                                                 │
│    74 │   │   │   logging.debug(f"Tracking command: {command_name} with arguments: {filtered_k                                                                                                                                                  │
│    75 │   │   │   track_event(command_name, properties=filtered_kwargs)                                                                                                                                                                         │
│    76 │   │   │                                                                                                                                                                                                                                 │
│ ❱  77 │   │   │   return func(*args, **kwargs)                                                                                                                                                                                                  │
│    78 │   │                                                                                                                                                                                                                                     │
│    79 │   │   return wrapper                                                                                                                                                                                                                    │
│    80                                                                                                                                                                                                                                           │
│                                                                                                                                                                                                                                                 │
│ ╭───────────────────────────────────────────────────────────────────────────────────────────────── locals ──────────────────────────────────��───────────────────────────────────────────────────────────────╮                                   │
│ │            args = ()                                                                                                                                                                                      │                                   │
│ │    command_name = 'run'                                                                                                                                                                                   │                                   │
│ │ filtered_kwargs = {'workflow': 'workflow.json', 'wait': True, 'verbose': True, 'host': None, 'port': None, 'timeout': 3600, 'cli_version': '1.4.0', 'tracing_id': 'e0dc5c45-1d51-4a31-8a92-018ac5b86c26'} │                                   │
│ │          kwargs = {'workflow': 'workflow.json', 'wait': True, 'verbose': True, 'host': None, 'port': None, 'timeout': 3600}                                                                               │                                   │
│ │     sub_command = None                                                                                                                                                                                    │                                   │
│ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                   │
│                                                                                                                                                                                                                                                 │
│ /usr/local/lib/python3.10/site-packages/comfy_cli/cmdline.py:444 in run                                                                                                                                                                         │
│                                                                                                                                                                                                                                                 │
│   441 │   if not port:                                                                         ╭──────────────────────────────────── locals ─────────────────────────────────────╮                                                              │
│   442 │   │   port = 8188                                                                      │      config = <comfy_cli.config_manager.ConfigManager object at 0x7fca4c198eb0> │                                                              │
│   443 │                                                                                        │        host = '127.0.0.1'                                                       │                                                              │
│ ❱ 444 │   run_inner.execute(workflow, host, port, wait, verbose, local_paths, timeout)         │ local_paths = False                                                             │                                                              │
│   445                                                                                          │        port = 8188                                                              │                                                              │
│   446                                                                                          │     timeout = 3600                                                              │                                                              │
│   447 def validate_comfyui(_env_checker):                                                      │     verbose = True                                                              │                                                              │
│                                                                                                │        wait = True                                                              │                                                              │
│                                                                                                │    workflow = 'workflow.json'                                                   │                                                              │
│                                                                                                ╰──────────────────────────────────────────────────────────────────��──────────────╯                                                              │
│                                                                                                                                                                                                                                                 │
│ /usr/local/lib/python3.10/site-packages/comfy_cli/command/run.py:73 in execute                                                                                                                                                                  │
│                                                                                                                                                                                                                                                 │
│    70 │   │   │   execution.connect()                                                                                                                                                                                                           │
│    71 │   │   execution.queue()                                                                                                                                                                                                                 │
│    72 │   │   if wait:                                                                                                                                                                                                                          │
│ ❱  73 │   │   │   execution.watch_execution()                                                                                                                                                                                                   │
│    74 │   │   │   end = time.time()                                                                                                                                                                                                             │
│    75 │   │   │   progress.stop()                                                                                                                                                                                                               │
│    76 │   │   │   progress = None                                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                 │
│ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────── locals ─────────────────────────────────────────────────────────────────────────────────────────────────────────────╮            │
│ │     execution = <comfy_cli.command.run.WorkflowExecution object at 0x7fca4ba7b4c0>                                                                                                                                               │            │
│ │          host = '127.0.0.1'                                                                                                                                                                                                      │            │
│ │   local_paths = False                                                                                                                                                                                                            │            │
│ │          port = 8188                                                                                                                                                                                                             │            │
│ │      progress = <comfy_cli.command.run.ExecutionProgress object at 0x7fca4ba7a4a0>                                                                                                                                               │            │
│ │         start = 1748602747.9621973                                                                                                                                                                                               │            │
│ │       timeout = 3600                                                                                                                                                                                                             │            │
│ │       verbose = True                                                                                                                                                                                                             │            │
│ │          wait = True                                                                                                                                                                                                             │            │
│ │      workflow = {XXX}                                                                                                                                                                                                               
│ │ workflow_name = '/mnt/code/workflow.json'                                                                                                                                                                                        │            │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯            │
│                                                                                                                                                                                                                                                 │
│ /usr/local/lib/python3.10/site-packages/comfy_cli/command/run.py:165 in watch_execution                                                                                                                                                         │
│                                                                                                                                                                                                                                                 │
│   162 │   │   │   message = self.ws.recv()                                                     ╭─────────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────────╮ │
│   163 │   │   │   if isinstance(message, str):                                                 │ message = {'type': 'executing', 'data': {'node': '406.0.0.428', 'display_node': '428', 'prompt_id': '680e5783-c32e-476d-8ee9-e2eb6110f661'}} │ │
│   164 │   │   │   │   message = json.loads(message)                                            │    self = <comfy_cli.command.run.WorkflowExecution object at 0x7fca4ba7b4c0>                                                                 │ │
│ ❱ 165 │   │   │   │   if not self.on_message(message):                                         ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│   166 │   │   │   │   │   break                                                                                                                                                                                                                 │
│   167 │                                                                                                                                                                                                                                         ���
│   168 │   def update_overall_progress(self):                                                                                                                                                                                                    │
│                                                                                                                                                                                                                                                 │
│ /usr/local/lib/python3.10/site-packages/comfy_cli/command/run.py:213 in on_message                                                                                                                                                              │
│                                                                                                                                                                                                                                                 │
│   210 │   │   │   return True                                                                  ╭─────────────────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────────────────╮ │
│   211 │   │                                                                                    │    data = {'node': '406.0.0.428', 'display_node': '428', 'prompt_id': '680e5783-c32e-476d-8ee9-e2eb6110f661'}                                │ │
│   212 │   │   if message["type"] == "executing":                                               │ message = {'type': 'executing', 'data': {'node': '406.0.0.428', 'display_node': '428', 'prompt_id': '680e5783-c32e-476d-8ee9-e2eb6110f661'}} │ │
│ ❱ 213 │   │   │   return self.on_executing(data)                                               │    self = <comfy_cli.command.run.WorkflowExecution object at 0x7fca4ba7b4c0>                                                                 │ │
│   214 │   │   elif message["type"] == "execution_cached":                                      ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│   215 │   │   │   self.on_cached(data)                                                                                                                                                                                                          │
│   216 │   │   elif message["type"] == "progress":                                                                                                                                                                                               │
│                                                                                                                                                                                                                                                 │
│ /usr/local/lib/python3.10/site-packages/comfy_cli/command/run.py:237 in on_executing                                                                                                                                                            │
│                                                                                                                                                                                                                                                 │
│   234 │   │   │   │   self.remaining_nodes.discard(self.current_node)                          ╭────────────────────────────────────────────────── locals ──────────────────────────────────────────────────╮                                   │
│   235 │   │   │   │   self.update_overall_progress()                                           │ data = {'node': '406.0.0.428', 'display_node': '428', 'prompt_id': '680e5783-c32e-476d-8ee9-e2eb6110f661'} │                                   │
│   236 │   │   │   self.current_node = data["node"]                                             │ self = <comfy_cli.command.run.WorkflowExecution object at 0x7fca4ba7b4c0>                                  │                                   │
│ ❱ 237 │   │   │   self.log_node("Executing", data["node"])                                     ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────╯                                   │
│   238 │   │   return True                                                                                                                                                                                                                       │
│   239 │                                                                                                                                                                                                                                         │
│   240 │   def on_cached(self, data):                                                                                                                                                                                                            │
│                                                                                                                                                                                                                                                 │
│ /usr/local/lib/python3.10/site-packages/comfy_cli/command/run.py:181 in log_node                                                                                                                                                                │
│                                                                                                                                                                                                                                                 │
│   178 │   │   if not self.verbose:                                                             ╭─────────────────────────────────── locals ──────────��────────────────────────╮                                                                 │
│   179 │   │   │   return                                                                       │ node_id = '406.0.0.428'                                                      │                                                                 │
│   180 │   │                                                                                    │    self = <comfy_cli.command.run.WorkflowExecution object at 0x7fca4ba7b4c0> │                                                                 │
│ ❱ 181 │   │   node = self.workflow[node_id]                                                    │    type = 'Executing'                                                        │                                                                 │
│   182 │   │   class_type = node["class_type"]                                                  ╰──────────────────────────────────────────────────────────────────────────────╯                                                                 │
│   183 │   │   title = self.get_node_title(node_id)                                                                                                                                                                                              │
│   184                                                                                                                                                                                                                                           │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: '406.0.0.428'

To Reproduce
working on giving an example.

Expected behavior
Not to crash

Nice to have

  • Terminal output
  • Screenshots

Additional context
Workflow was working perfectly in comfy-ui web interface.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions