An engine vacuum leak from the intake manifold gasket can cause the engine to misfire or have a rough idle. This will turn on the Check Engine Light and diagnostic trouble codes will be stored. It is advisable to drive your car as little as possible when the engine is misfiring to avoid damaging the catalytic converter, which can cost many hundreds - thousands of dollars. See how much it cost you here