Most likely cause for this is the program puts the chip to low power. Once in low power, the JTAG commands cannot be accessed. This could cause such a message to come up.
I am assuming other programs are working correctly and only this one has a problem. Below are few forum threads which talk about loss of connection to a target device.