Skip to content

Commit 1e41c6d

Browse files
fix: Handle missing subgraph inputs gracefully during workflow import (#4985)
When loading workflows, SubgraphNode would throw an error if an input exists in the serialized data that doesn't exist in the current subgraph definition. This can happen when: - Subgraph definitions change after workflows are saved - Workflows are shared between users with different subgraph versions - Dynamic inputs were added that don't exist in the base definition This change converts the hard error to a warning and continues processing, allowing workflows to load even with mismatched subgraph configurations. Fixes #4905
1 parent 5224c63 commit 1e41c6d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/lib/litegraph/src/subgraph/SubgraphNode.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,14 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph {
266266
const subgraphInput = this.subgraph.inputNode.slots.find(
267267
(slot) => slot.name === input.name
268268
)
269-
if (!subgraphInput)
270-
throw new Error(
271-
`[SubgraphNode.configure] No subgraph input found for input ${input.name}`
269+
if (!subgraphInput) {
270+
// Skip inputs that don't exist in the subgraph definition
271+
// This can happen when loading workflows with dynamically added inputs
272+
console.warn(
273+
`[SubgraphNode.configure] No subgraph input found for input ${input.name}, skipping`
272274
)
275+
continue
276+
}
273277

274278
this.#addSubgraphInputListeners(subgraphInput, input)
275279

0 commit comments

Comments
 (0)