There are so many options.
If it is a pre-facelift 6 cylinder it will have the M54 engine. My E46 Compact had that, and the only time the EML lit up I drove it a decent distance and next time I used it the light stayed off. When I got the code read the fault was with one of the hydraulic valve lifters. It never happened again, thankfully.
I think it was because I had started the car a couple of times just to move it a few feet.