Shop Floor Monitor

The error message tells you that it has nothing to do with your templates or even how you are creating the Diagram, but how you are initializing the Model.

In particular, your code:

myDiagram.model = new go.TreeModel(document.getElementById("mySavedModel").value);

is passing a string as the first argument to the TreeModel constructor. But the first argument should be an Array of Objects: TreeModel | GoJS API

You have a choice.

Either make sure the contents of the textarea contain a TreeModel in JSON format, in which case you can call Model.fromJson, just as so many of the samples do.

Or parse the textarea string into an Array and pass that to your TreeModel constructor.