I had the same error. It took me a LONG way to figure it out, but in my case the problem was that I used LDATE_AND_TIME. It seems to be not supported, at least not in the Codesys version I used (3.5.16)