Nexus 5 Encryption Issue

I ran into a curious issue when trying to encrypt my new Nexus 5 phone. Even when using a PIN and starting with a fully charged phone, each time I tried to enable encryption, the phone would immediately reboot but then nothing would happen. Several users on various forums managed to get their new Nexus to encrypt after repeated tries but I wasn’t having any such luck. Another user suggested trying again while using the AC adapter which came with the phone. This time, it worked! Somehow the phone detected that I wasn’t using the stock AC adapter when I tried to enable encryption earlier. On the other hand, it would have been nice to see an error message instructing me to do just that rather than leaving people stuck with phones that won’t encrypt.