You almost certainly have a vacuum leak somewhere.
Check the plastic tube from the air filter box to the throttle body for cracks. On pre 2015 models those were failing often.
Completely remove it to check the underside.
If you can find a vacuum leak it could be the mass airflow sensor.