Skip to content

[bug] TypeError when loading workflows with promoted widgets - _listenerController.abort not a function #1130

@christian-byrne

Description

@christian-byrne

Description

When loading a workflow that contains promoted widgets, the following error occurs:

TypeError: input._listenerController?.abort is not a function
    at #addSubgraphInputListeners (SubgraphNode.ts:104:32)
    at ComfyNode._internalConfigureAfterSlots (SubgraphNode.ts:169:12)
    at ComfyNode.configure (LGraphNode.ts:761:10)

Steps to Reproduce

  1. Create a subgraph with DOM widgets
  2. Connect a DOM widget to a subgraph input (promoting it)
  3. Save the workflow
  4. Reload the page or load the saved workflow
  5. Error occurs during deserialization

Root Cause

The _listenerController property on input slots is not serialized/deserialized. When loading a workflow:

  • Input slots are plain objects from JSON
  • They don't have _listenerController property
  • Code assumes optional chaining (?.) is enough, but abort might not be a function
  • This happens in 3 places: #addSubgraphInputListeners, configure, and onRemoved

Expected Behavior

Workflows with promoted widgets should load without errors.

Actual Behavior

TypeError is thrown because the code tries to call abort() on a non-existent or non-AbortController object.

Solution

Add proper type checking before calling abort:

// Instead of:
input._listenerController?.abort()

// Use:
if (input._listenerController && typeof input._listenerController.abort === 'function') {
  input._listenerController.abort()
}

This needs to be fixed in:

  1. SubgraphNode.#addSubgraphInputListeners (line 104)
  2. SubgraphNode.configure (line 142)
  3. SubgraphNode.onRemoved (line 356)

Environment

  • litegraph.js version: 0.16.9
  • Affects: All browsers
  • Severity: High (breaks workflow loading)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions