Do you have a second key? Did you try that? If a key isn't programmed correctly to the car, it will do exactly that. Start, then the car realizes the key isn't programmed to the car, and the computer shuts the engine off. I've had other cars with keys cut that weren't programmed correctly that did this. Try your other key, if you have one.I'm joining this convo 8 years later but, I have the same problem. 2008 Outback 2.5. Starts easily, runs for .5 seconds and shuts off as if you removed the key. It's just weird it's like the car is getting a 'shut down now' message from somewhere. The question is where? Not getting and CEL codes, fuel pressure is great, all wires, connections, grounds, etc seem good. The only thing is that I replaced the air filter 2 days ago. It ran fine yesterday but, then this started today. Did anyone figure out the issue here?
Hopefully, it's not a weird issue related to this that is a PITA to deal with. A bad fuel pump or something may be easier to deal with. lol
Good Luck