It happens when loyalty is very low and the king has low influence. If the king goes campaigning the loyalty of his generals increases a lot.