Unfortunately this is a fairly generic error that could point to a lot of things. The best guess would be that there is bad data in one of the tables that you are querying.
If you could turn your log levels up to 5 here
C:\Program Files (x86)\ArcGIS\WMX\Desktop10.2\Bin\WMXAdvancedSettings.exe
And try and replicate the issue, then you could use the logs for more information as to what potentially is the cause
Remember to turn the log levels down once you're done, and feel free to pass on the log message and we can continue to work on your issue if the answer is not clear.