From 6265dfac38a4f5930314de247c327c36cf335bea Mon Sep 17 00:00:00 2001 From: Comfy Org PR Bot Date: Fri, 15 Aug 2025 12:22:12 +0800 Subject: [PATCH] fix: Handle missing subgraph inputs gracefully during workflow import (#4985) (#4986) 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 Co-authored-by: Christian Byrne --- src/lib/litegraph/src/subgraph/SubgraphNode.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/litegraph/src/subgraph/SubgraphNode.ts b/src/lib/litegraph/src/subgraph/SubgraphNode.ts index e7d721182b..57c86894c8 100644 --- a/src/lib/litegraph/src/subgraph/SubgraphNode.ts +++ b/src/lib/litegraph/src/subgraph/SubgraphNode.ts @@ -266,10 +266,14 @@ export class SubgraphNode extends LGraphNode implements BaseLGraph { const subgraphInput = this.subgraph.inputNode.slots.find( (slot) => slot.name === input.name ) - if (!subgraphInput) - throw new Error( - `[SubgraphNode.configure] No subgraph input found for input ${input.name}` + if (!subgraphInput) { + // Skip inputs that don't exist in the subgraph definition + // This can happen when loading workflows with dynamically added inputs + console.warn( + `[SubgraphNode.configure] No subgraph input found for input ${input.name}, skipping` ) + continue + } this.#addSubgraphInputListeners(subgraphInput, input)