2008 Subaru Impreza running poorly/roughly at idle

Hi all, I have a 2008 Subaru Impreza with about 126k miles (auto transmission) which is my daily driver. This last Saturday, I filled up the gas tank and jumped back on the highway and after about 5 minutes of driving at highway speeds, my check engine light came on and the cruise control light started blinking. I thought maybe the gas cap was loose or something since I had just filled up, but that wasn’t the issue. The car ran fine the rest of the day and got me home ok.

On Sunday, I pulled out my engine code reader and it returned the dreaded “P0420” code. As an avid Subaru driver for the past ~15 years, that code sends a chill down my spine. I reset the code and have driven the car every day since then, but the CEL has stayed off.

However, starting yesterday and especially today, the car has started to run really rough at idle. While sitting still, you can watch the RPM run around 800-900 and the slowly move down until it gets around 500 at which the point the car starts bucking, lights momentarily flash on the dashboard, and then the RPMs kick back up to ~1000, only to repeat the whole process every 20 seconds or so. I tried turning off the A/C thinking maybe the compressor turning on was the culprit, but no change.

It seems to get slightly better as the car warms up, but it’s still noticeable even when it’s hot.

So I guess the question is was the CEL and P0420 related to what’s going on now even if the CEL hasn’t come back? Did I get bad gas or something? For what it’s worth, we were on a day trip and I stopped at a gas station I’ve never been to before…

Is the car still acting up? Not clear from your post.

If it has cleared up, I’d say you got some bad gas. Run the tank out, maybe add a little fuel injector cleaner and keep an eye on things.

when I had 2007 Outback, it developed a rough idle around 90K miles

I cleaned the throttle plate, do not recall if I had to clean idle air valve as I did before on older Outbacks, but that took care of the issue and it was smooth again

not sure if it has anything to do with P0420 although, as it indicates a failing catalyst, but potentially may also be caused by deteriorating O2 sensor