In my case, the Leaf tech at the dealership (Nissan of Van Nuys) said that the Azuga Insight device I had plugged into the OBDII port was not compatible with the Leaf's systems, was causing it to throw upwards of 20 codes sporadically, and that they tested the 12 V battery and found that it was healthy. So they simply unplugged the Azuga Insight device and found that no more codes were being triggered. They surmised that the device was somehow causing the loss of power issues I was having, and said not to use it.
I was surprised as I had not even thought of it. I was using the Azuga Insight device as part of the California Road Charge Pilot program. It monitors number of miles driven and GPS location of the vehicle, and transmits that to Azuga so they can keep track of how much I am driving and produce a simulated "road charge fee". No money actually changes hands, this is just a pilot test to see how much people would pay if California decided to remove charge BEV drivers for road usage (since we don't pay gasoline tax and yet the roads still need fixin').
Anyway, the device had definitely had problems operating as it was supposed to (it took forever and troubleshooting sessions with Azuga to get it actually recording and transmitting), but I never considered that it might be throwing codes in the car itself, or that it could potentially lead to loss of power.
I'm skeptical that it's the real cause, but now that it's unplugged and the pilot program is over, I'll just wait and see if the problem occurs again over the next 6 months. If not, I'll conclude the tech was right.
2014 Leaf S with Charger Package (Blue Ocean)
Purchased 4/25/2014, Totaled (hit from behind on freeway) 9/20/2016
2016 Leaf SV (Glacier White)