Vacuum leak, fuel injection, or spark problem. Under open throttle, it's not an issue because you are flooding the engine with vast amounts of whatever it is you need. At idle, firing is more picky and if any fuel, air, or spark are insufficient, combustion will fail.
Could even be sensor...