Ok, so it seems the problem is that your input to AutoMPO is simply not valid input. This doesn't have to do with the number of operators, but you have to following pattern:
ampo += coef,string,integer,string,integer, ....;
So like:
ampo += 0.5,"Cdagup",i,"Cup",j;
Please look at the code example I posted in the comment in the other thread and use that code as a pattern to follow for your own code.