Inject nodes buttons disabled after deploying a node generated from a subflow

I have a strange situation I hope someone can help with. I am developing a node using Packaging a Subflow as a module. When I place the node on the flow and deploy then in the developer console I see

 Uncaught TypeError: Cannot read properties of undefined (reading 'name')
    at <anonymous>:341:118
    at (<anonymous>)
    at Array.handleDebugMessage (<anonymous>:333:47)
    at i.onmessage (red.min.js?v=5a8f4f4e892d:16:35606)

and the buttons on all inject nodes become greyed out. If I move a node and re-deploy then there is no error and the buttons are back to normal.
If I open the node and edit any property apart from Name and deploy then I see the same situation.
If I give it a name then the issue goes away, unless I blank the name again, in which case the problem returns.
I am seeing this in 3.1.6 and 4.0.0 beta 1. Is there something I can do to prevent it or is this a bug?

To see the problem the node can be installed using
npm install colinl/node-red-guaranteed-delivery
It is called Guaranteed Delivery and appears in the Functions category.

My best guess from that stacktrace and your description is your subflow is triggering a message in the debug sidebar somehow, but as its a packaged subflow, the editor doesn't know about the nodes inside it so some of the logic around handling messages in the debug sidebar doesn't cope with a node id it cannot lookup.

Please raise an issue.

That makes me realise that I have a node.warn() statement in the OnStart of a function node in the subflow, so perhaps that is it.

I have confirmed that the problem during deploy is caused by node.warn() in the Function node onStart. However I also get the browser error if I use node.warn() in the onMessage code, and the warn message does not appear in the debug pane. Does that mean that I just can't use warn() in a packaged subflow, or is it something that can be improved? If so then I will submit an issue.

It seems reasonable for a subflow module to be able to log to the sidebar and for it to be handled appropriately.

Issue submitted Subflows packaged as modules are not able to use node.warn() · Issue #4641 · node-red/node-red · GitHub