This sounds like it could be caused by some corner/race condition in your code. While that might normally be impossible to track down, we have a great program that allows you to log all of the commands across the GPIB bus for later analysis called NI-Spy (see how to use it here). Try using that to analyze the commands and post the file to the forums for us to take a look at. We can see if there is anything surrounding the bad command that looks funny. I look forward to hearing back from you.