Thanks @waako, sorry line 377 does make sense, its the line where emoncms loads the inputs from mysql into redis: https://github.com/emoncms/emoncms/blob/stable/Modules/input/input_model.php#L377
It sounds like something has gone a bit amiss in the inputs table in the emoncms mysql database, perhaps the table has crashed somehow, as it appears that emoncms is trying to recreate all fields!
Would you be able to login to mysql on the pi locally and check the inputs table? try:
mysql -u emoncms -p emoncms
password: emonpiemoncmsmysql2016
SELECT * FROM inputs;
Then you could try (I’ve only ever had to do this once 5+ years ago so not sure if it will sort it):
REPAIR TABLE inputs;