on autoformat: String index out of range: 1023

Hmm, okay.

Can you reduce the sketch to a small one that has the same problem? That would make it easier to debug.