2004 Subaru Legacy stalling

Got a Legacy sedan limited that keeps stalling on me. Had it into the dealer twice with no luck. No codes, lights, nothing. It will stall at a stop sign and sometimes when starting. This will last anywhere from once to 4 or 5 times then it will run fine for a day or even a week and it will do it again.

I had a problem like this on a 1996 Outback, again with no codes, and replaced the MAS (mass airflow sensor) - it never happened again. That said, I gave that same MAS to a friend several years later because the MAS on his car failed. He cleaned the sensor element and used it for two years with no problems at all. So, it may be that cleaning the sensor will resolve your problem....

2004 subaru keeps stalling...have to push gas pedal to get it started then when i let off...it dies...some days it goes just fine then it will start doing this again..also at times AT OIL TEMP light will flash when this is happening...seems like after car cools down, it will start back up with no problem