GPF when I add to a string for a webpage

I have a Makerfabs MATouch 2.1 ESP32-S3 Rotary that I have built out to be a diesel heater control head and also providing a web interface. The web interface is simple HTML with javascript. My problem is I can add to a string which makes up the web page and code compiles fine but gets a Guru Protection Fault at boot. Then if I simply change the string like add a remark to the HTML and compile the code compiles and runs fine.

In both cases the code does not even get called. and the debug code suggests the error is in a call to LittleFS

Example: (there is a lot more code than this)
This works:

clockVars += "setInterval(" + name + ".read, 1000," + name + ");\n";
clockVars += "\n//  The last one MUST NOT have a comma\n";

This results in a GPF at boot

clockVars += "setInterval(" + name + ".read, 1000," + name + ");\n";
clockVars += "\n";

Would anyone be able to point me in some direction of help