I get the same error after some random time. I was not able to link this to an specific event. Maybe it happens on receiving a protocol an changing the state.

It always occured when i restarted the daemon by "service pilight restart". Most of the time I did this because it used the whole cpu (~95%). A random (i think so far it's random) state is set to an invalid value. For me it was "down" instead of "off".