From 80d75bb1647546c00501b0bd93df4d0a7e3810e7 Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Thu, 18 Sep 2025 23:27:42 -0700 Subject: [PATCH] fix TypeError: nodes is not iterable when loading graph (#5660) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary - Fixes Sentry issue CLOUD-FRONTEND-STAGING-29 (TypeError: nodes is not iterable) - Adds defensive guard to check if nodes is valid array before iteration - Gracefully handles malformed workflow data by skipping node processing ## Root Cause The `collectMissingNodesAndModels` function in `src/scripts/app.ts:1135` was attempting to iterate over `nodes` without checking if it was a valid iterable, causing crashes when workflow data was malformed or missing the nodes property. ## Fix Added null/undefined/array validation before the for-loop: ```typescript if (\!nodes || \!Array.isArray(nodes)) { console.warn('Workflow nodes data is missing or invalid, skipping node processing', { nodes, path }) return } ``` Fixes CLOUD-FRONTEND-STAGING-29 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5660-fix-TypeError-nodes-is-not-iterable-when-loading-graph-2736d73d365081cfb828d27e59a4811c) by [Unito](https://www.unito.io) --- src/scripts/app.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/scripts/app.ts b/src/scripts/app.ts index 853242bf0..43722f9b4 100644 --- a/src/scripts/app.ts +++ b/src/scripts/app.ts @@ -1121,6 +1121,13 @@ export class ComfyApp { nodes: ComfyWorkflowJSON['nodes'], path: string = '' ) => { + if (!Array.isArray(nodes)) { + console.warn( + 'Workflow nodes data is missing or invalid, skipping node processing', + { nodes, path } + ) + return + } for (let n of nodes) { // Patch T2IAdapterLoader to ControlNetLoader since they are the same node now if (n.type == 'T2IAdapterLoader') n.type = 'ControlNetLoader'