TypeError: node.scope.forEach is not a function

Is there a known issue when creating a subflow from selected nodes and then restarting getting the error

TypeError: node.scope.forEach is not a function
    at Subflow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/flows/Flow.js:245:36)
    at Subflow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/flows/Subflow.js:317:15)
    at Flow.start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/flows/Flow.js:208:41)
    at start (/usr/lib/node_modules/node-red/node_modules/@node-red/runtime/lib/nodes/flows/index.js:345:33)
    at tryCatchReject (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:845:30)
    at runContinuation1 (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:804:4)
    at Fulfilled.when (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:592:4)
    at Pending.run (/usr/lib/node_modules/node-red/node_modules/when/lib/makePromise.js:483:13)
    at Scheduler._drain (/usr/lib/node_modules/node-red/node_modules/when/lib/Scheduler.js:62:19)
    at Scheduler.drain (/usr/lib/node_modules/node-red/node_modules/when/lib/Scheduler.js:27:9)

The subflow also did not seem to be receiving messages. When I removed it, created a new emtpy subflow and copied the nodes into it then it seemed ok.

node-red 1.0.4, nodejs 12.16.1

Any known issue of that sort of error would be on https://github.com/node-red/node-red/issues

I've not seen that error before and I've been exercising the convert-subflow path a lot in the last few days.

Does it happen every time? Does it happen regardless of what nodes you are converting?

Looking at the line throwing the error, it is related to the Complete node. Do you have any Complete nodes? Are they included in the selection you are converting?

Yes and Yes. I don't know whether it is reproducible, I will try again.
It is used with an email node.

It is repeatable, in fact it seems to need just any node and an associated Complete node. Mark them and make a subflow from selected nodes, then on deploy it gives the error. If instead a new subflow is created and the nodes copied/pasted then there is no error.
Issue submitted https://github.com/node-red/node-red/issues/2514

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.