Don't know if you got sorted, but with BMW's, the Auto & SMG gearboxes can be very susceptible to low voltage batteries and throw all sorts of tantrums/failsafes/codes.
The fact that it's intermittent, the first thing I'd do is test the battery & alternator - if the battery is a few years old (even if showing healthy), I'd still replace it.