Wow, this is an overly complex bit of code. It's very hard to follow!

Do you perhaps have a format specifier without a corresponding argument?

Check your code at the line specified in the error...