The most likely cause is a split in the hose between the AFM/AMM and the throttle body or worst case scenario, the AFM/AMM itself. Also if the AFM/AMM is unplugged it will do the same.
Also check all your breather hoses for splits, security and also for blockages. Usually blocked breathers cause various symptoms including rough running so i would look more for splits, disconnected hoses etc.
Also check the idle control valve and the hoses attached to it.