Engine races

We have a 2000 Subaru Legacy - manual transmission. In the morning after the car sits all night, the engines races when the car is started. Lately, the “check engine” light to come on if the engine races; however, after the car sits for a few hours, the check engine light turns off. What is causing the engine to race? Is the check engine light coming on a result of the racing engine?

The check engine light is coming on because there may be a small problem, which is probably the cause of the engine racing. Have the code read and ask the people who read to tell you what it means. That is where you should start.

The check engine light isn’t as weird or mysterious as many seem to think. Nor does require guesswork. The next time this happens, drive the car to an auto parts chain such as Autozone. Ask them to scan the computer for error codes. Write down the exact code (e.g. P1234) and post it.

When you post the code(s), post the rest of the information people would need - such as the vehicles mileage and all information on basic maintenance items. Also include info on what happens after the car warms up or what it does on a warm restart. Does it race at all? Idle perfectly smoothly, or perhaps with a roughness or “lope?”

Exactly how fast is it “racing”?

What was the last work done on the car before this started?

My guess would be an intake leak post MAF sensor.
So anywhere between the throttle body and the intake manifolds.