2002 Buick Park Avenue - Engine stalls

It started with sometimes dash lights and gauges flash. This occurred about four times over two years. Then recently engines stalls has rough idle and surges then it will run fine sometimes for a hundred miles sometimes 100 feet.

What’s the condition/age of the battery?

I used to have a 2002 Chevrolet Malibu that acted in a similar weird way when the battery was about to go out.

Are the dash lights flashing while the engine is running badly?

Dash lights don’t flash when car acts up. My battery is five years old.