This sounds a crazy problem. I am wondering about an intermittent sensor fault caused by loose or dirty cable junctions / plugs, or a corrupted, or defective controller. I am deducing this not from serious e-bike wrenching experience like NielS and Saneagle have, but just the general experience...