P0171 on 2014-2021 Mazda CX-5: System Too Lean Causes and Fixes
On a 2014-2021 Mazda CX-5, code P0171 is most often caused by a vacuum leak from a failed intake manifold gasket or a dirty Mass Airflow (MAF) sensor. Less commonly, it can be caused by a failing low-pressure fuel pump, which was subject to a recall on some 2018-2019 model years. In some cases, a faulty purge solenoid valve or dirty fuel injectors can also be the culprit.
- P0171 on a CX-5 means the engine is getting too much air or not enough fuel.
- Start your diagnosis by checking for vacuum leaks, especially around the intake manifold gasket, and by cleaning the MAF sensor.
- Be aware of the known fuel pump issues; check for recalls on 2018-2019 models and consider it a likely cause if you also have a P0192 code. [, ]
- Before replacing any parts, ensure the air filter box is properly closed and sealed, as this simple mistake can trigger the code.
What's Unique About the 2014-2021 Mazda CX-5

While the causes for P0171 are common across many vehicles, the 2014-2021 Mazda CX-5 has specific vulnerabilities. The intake manifold gaskets on the Skyactiv engines are a known failure point, leading to vacuum leaks. Additionally, several NHTSA complaints and a recall (Mazda recall 5321K / NHTSA 21V-875) for 2018-2019 models point to issues with the low-pressure fuel pump, which can cause a lean condition and trigger this code. A Mazda Technical Service Bulletin (TSB MT-004-22) also acknowledges this code can appear with misfires (P030x codes) and outlines a diagnostic procedure that may end with replacing the fuel injectors.
Diagnostic Flowchart

Tap your situation to follow the diagnostic path that matches what you're seeing on this vehicle.
Generation note: This range covers two CX-5 generations: the first (KE, 2014-2016) and the second (KF, 2017-2021). While causes like vacuum leaks and dirty MAF sensors affect both, the fuel pump recall (5321K) specifically covers 2018-2019 models (KF generation). NHTSA complaints about fuel pumps also mention 2016 and 2017 models, straddling the generation change. The second generation (KF) introduced a redesigned body, a more premium interior, and engine updates, though the base 2.5L engine's core architecture remained similar.
Symptoms You May Notice
- Check Engine Light is on
- Rough idle or engine shaking, sometimes fluctuating RPM at stops
- Hesitation or lack of power during acceleration
- Engine stalling, especially when stopped or at low speeds
- Reduced fuel economy
- Hissing noise from the engine bay due to a vacuum leak
- Engine may be difficult to start or require a long crank time
- Replacing the oxygen sensor first. While it can be the cause, it's more often correctly reporting a problem that exists elsewhere, like a vacuum leak. Always diagnose vacuum leaks, MAF sensor issues, and fuel delivery problems before replacing sensors.
Most Likely Causes

- Vacuum Leak (Intake Manifold Gasket, PCV hose, etc.) 🔴 High Probability The intake manifold gaskets on Skyactiv engines are made of rubber that can become hard and brittle from heat cycles, causing them to crack and leak unmetered air. This is a very common failure point. Other vacuum lines, like the PCV hose or the brake booster line O-ring, can also degrade and leak.
How to confirm: Listen for a hissing sound at idle. With the engine running, carefully spray brake cleaner, carb cleaner, or a propane torch (unlit) around the intake manifold gasket area and vacuum hoses. If the engine RPM changes or stumbles, you've found the leak. A professional smoke test is the most definitive method to find hard-to-see leaks. 🎬 Watch: How to use a smoke machine for diagnosis
Typical fix: Replace the failed gasket or hose. The intake manifold gasket is a common replacement. Four are required.
Est. part cost: $10-$40 for a set of four gaskets. - Dirty or Faulty Mass Airflow (MAF) Sensor 🔴 High Probability The MAF sensor measures the air entering the engine. If the sensing wire gets dirty from dust or oil, it will under-report the amount of air, causing the PCM to inject too little fuel and create a lean condition.
How to confirm: Unplug the MAF sensor with the engine running. If the idle smooths out or the engine stalls, the sensor is likely faulty. Remove the sensor and inspect it for dirt or debris. You can try cleaning it with a dedicated MAF sensor cleaner spray. 🎬 Watch: How to safely clean your MAF sensor Do not touch the delicate wires. If cleaning doesn't work, the sensor may need replacement.
Typical fix: Clean the MAF sensor with a specialized cleaner. If the problem persists, replace the sensor.
Est. part cost: $10 for cleaner, $70-$284 for a new sensor. - Failing Low-Pressure Fuel Pump 🟡 Medium Probability NHTSA recall 5321K (NHTSA ID: 21V-875) was issued for 2018-2019 CX-5s due to a defective fuel pump impeller that can crack or deform, leading to insufficient fuel delivery. This can cause stalling, rough operation, and a check engine light. Owner complaints suggest similar failures on other model years like 2016 and 2017.
How to confirm: A fuel pressure test is required to confirm low pressure from the pump. This code is often accompanied by P0192 (Low Fuel Rail Pressure) when the fuel pump is the cause. Check your VIN on Mazda's recall website or the NHTSA site to see if it's covered.
Typical fix: Replace the low-pressure fuel pump. If your vehicle is covered under the recall, the replacement is free at a Mazda dealer. 🎬 See this overview of the fuel pump recall
Est. part cost: $200-$400 - Clogged or Dirty Fuel Injectors ⚪ Low Probability Mazda TSB MT-004-22 (which supersedes MT-021/17) lists replacing fuel injectors as the final repair step if inspections of the air intake, MAF, and A/F sensor do not resolve the lean condition. Carbon buildup can restrict fuel flow, preventing the injectors from opening properly.
How to confirm: This is difficult to diagnose without professional tools. A mechanic can perform a fuel injector balance test. Sometimes, running a high-quality fuel system cleaner through the tank can help, but if they are significantly clogged, they may need to be removed for professional cleaning or replacement.
Typical fix: Clean or replace the fuel injectors.
Est. part cost: $50-$150 per injector
Rare But Worth Checking
- Improperly Seated Air Filter Box: Several owners have reported that if the air filter housing is not closed and latched correctly after a filter change, it can create an air leak after the MAF sensor and trigger a P0171 code. Always double-check that the cover is properly seated and all clips are secure.
- Faulty Front Oxygen (A/F) Sensor: While a faulty sensor can cause this code, it's less common than a vacuum leak or MAF issue. The sensor can become slow or biased, sending incorrect lean readings to the PCM. It's usually the last part to replace after verifying fuel delivery and checking for leaks. In one forum case, a user reported that replacing the O2 sensor resolved the issue after other attempts failed.
- Faulty Purge Solenoid Valve: The evaporative emission (EVAP) purge solenoid can fail and stick open, creating a vacuum leak that pulls unmetered air (fuel vapor) from the charcoal canister into the intake manifold. This is a known cause for P0171 on other Mazda vehicles and has been mentioned by owners as a potential fix. Pinching off the vacuum line to the purge valve at idle and observing a 10% improvement in STFT can point to this issue.
Diagnosis Steps

- Read the code with an OBD-II scanner and check for any other codes, especially P0192 or P030x. Note the freeze frame data to see the engine conditions when the code was set.
- Visually inspect the engine bay for obvious issues like a disconnected vacuum hose or an improperly latched air filter box.
- Use a scan tool to monitor short-term (STFT) and long-term (LTFT) fuel trims at idle. High positive numbers (e.g., LTFT > 15-20%) that decrease when you raise the RPM to ~2500 suggest a vacuum leak. If the numbers stay high at all RPMs, it points more toward a fuel delivery or MAF issue.
- With the engine running, listen for hissing sounds. Spray carb cleaner or brake cleaner around the intake manifold gasket and vacuum lines; a change in engine idle indicates a leak.
- If a vacuum leak is suspected but not found, perform a smoke test to pinpoint the source of the leak.
- Remove and inspect the Mass Airflow (MAF) sensor. If it appears dirty, clean it with dedicated MAF sensor cleaner and let it dry completely before reinstalling.
- Check your VIN on the NHTSA or Mazda recall website to see if your vehicle is affected by the fuel pump recall (5321K).
- If fuel delivery is suspected, perform a fuel pressure test to check if the fuel pump is operating within specification. The high-pressure side should be at least 2,176 psi at full throttle, while the low-pressure side should be around 60 psi.
- If all else fails, consider testing the front oxygen (A/F) sensor or having the fuel injectors professionally cleaned or tested, as outlined in TSB MT-004-22.
Parts You'll Likely Need
- Intake Manifold Gasket
(OEM #PY01-13-111)— This is a very common failure point on Skyactiv engines, leading to vacuum leaks that cause a P0171 code. Four gaskets are required for the job.
Trusted brands: Mazda OE, Fel-Pro, Victor Reinz
OEM price range: $8-$15 per gasket
Aftermarket price range: $5-$10 per gasket - Mass Airflow (MAF) Sensor
(OEM #PE01-13-215)— A dirty or failed MAF sensor is a frequent cause, as it provides incorrect airflow data to the engine computer. Cleaning is often successful, but replacement is sometimes necessary.
Related Codes That Often Appear With This One
- P0174 — System Too Lean (Bank 2). This is not applicable to the CX-5's inline 4-cylinder engine, which only has one bank.
- P0300, P0301, P0302, P0303, P0304 — Random or specific cylinder misfires. A lean condition can cause incomplete combustion, leading to misfires. TSB MT-004-22 specifically mentions that P0171 may appear with misfire codes (P030X).
- P0192 — Fuel Rail Pressure Sensor Circuit Low. This code strongly points towards a fuel delivery problem, such as a failing low-pressure fuel pump, as seen in multiple NHTSA owner complaints.
Technical Service Bulletins (TSBs) & Recalls
- MT-004-22 (Supersedes MT-021/17): Addresses P0171 possibly accompanied by P030x misfire codes. Outlines an inspection procedure for the airbox, MAF, and A/F sensor, and if the lean condition persists, recommends replacing the fuel injectors.
Platform-Specific Known Issues
- Fuel Pump Recall: Mazda issued recall 5321K for certain 2018-2019 CX-5 models due to a faulty low-pressure fuel pump impeller that could deform and cause the pump to fail, potentially leading to a stall. Symptoms included a check engine light and rough running.
- NHTSA Fuel Pump Complaints: Owners of 2016 and 2017 models have filed complaints with the NHTSA reporting P0171 along with P0192 (low fuel rail pressure), attributing the failure to the fuel pump. [, , ]
- Intake Manifold Gasket Failure: The intake manifold gaskets on the 2.0L and 2.5L Skyactiv engines are a well-documented failure point that causes vacuum leaks and triggers the P0171 code.
Mechanic-Grade Diagnostic Values
- Long Term Fuel Trim (LTFT) at idle — expected: Close to 0%, within +/- 10%. Failure: Sustained reading greater than +15% to +20%. A value of +25% will typically set the P0171 code.
- Short Term Fuel Trim (STFT) response to RPM increase — expected: If high at idle (e.g., >+15%), it should decrease towards 0% when RPM is raised to ~2500.. Failure: If STFT drops significantly with increased RPM, it strongly suggests a vacuum leak. If it remains high or increases, it points to a fuel delivery or MAF sensor issue.
- Mass Airflow (MAF) Sensor Reading at Idle — expected: Approximately 1.8 to 4.0 grams/second (g/s) for a 2.0L/2.5L engine at normal idle.. Failure: A very low reading (e.g., 1.8 g/s) that barely increases with RPM can indicate a faulty sensor, even if it doesn't set a MAF-specific code.
- Front A/F (Wideband O2) Sensor Reading — expected: Modern wideband sensors read in milliamps (mA) or Lambda. A scan tool may show this as a current fluctuating around 0 mA or Lambda=1.0.. Failure: Being stuck with a high positive or negative current, or a Lambda value significantly different from 1.0, can indicate a sensor or mixture problem.
- Rear O2 Sensor (Narrowband) Voltage at Idle — expected: A relatively stable voltage, typically between 0.4V and 0.7V, after the catalytic converter is warmed up.. Failure: A very low, stable voltage (e.g., ~0.1V) indicates a lean condition or a large exhaust leak before the sensor. Voltage that mimics the fluctuating front O2 sensor indicates a failing catalytic converter (P0420/P0421).
- High-Pressure Fuel Rail Pressure (Desired vs. Actual) — expected: Actual pressure should closely mirror the desired pressure commanded by the PCM. At full throttle, this can be over 2,100 psi.. Failure: If the actual pressure is significantly lower than desired (e.g., desired is 400+ psi but actual is stuck at 62 psi), it points to a failing high-pressure or low-pressure fuel pump.
Scan Tool Commands That Help
- Mazda M-MDS (or equivalent advanced scan tool): PID/DATA MONITOR INSPECTION — Used to monitor live data PIDs such as SHRT_FUEL_TRIM, LONG_FUEL_TRIM, MAF, FUEL_PRES, and O2 sensor values (O2S11, O2S12) to diagnose the lean condition as per the official Mazda diagnostic procedure for P0171.
- Mazda M-MDS: Fuel Pressure (Low-Side) Malfunction Verification — This procedure involves disabling the high-pressure fuel pump via the scan tool or by disconnecting its connector to isolate and test the low-pressure side, which is critical if a fuel pump issue is suspected.
Real Owner Repair Stories
- Mazdas247 Forum User (2013 Mazda CX-5) — Check Engine Light with code P0171.
❌ Tried (didn't work) Googling for complex causes like O2 sensors and fuel injectors.
✅ What actually fixed it The air filter box cover was not seated correctly after a recent service. The rear tabs were not in their slots, creating an unmetered air leak post-MAF sensor. Properly closing the air box and securing the clips resolved the issue. - Reddit user in r/MechanicAdvice (2017 Mazda CX-5) — Recurring P0171 code, especially at idle or when parking. High LTFT at idle that did not improve while driving.
❌ Tried (didn't work) Replacing the front oxygen sensor., Performing a smoke test (no leaks found)., Replacing the PCV valve., Replacing the high-pressure fuel pump.
✅ What actually fixed it Replacing the Mass Airflow (MAF) sensor. The user first tested with a cheap junkyard MAF sensor, which fixed the problem, confirming the original sensor was faulty despite not setting a MAF-specific code. - Mazdas247 Forum User 'swargo' (2013 Mazda CX-5 Touring, ~38k miles) — P0171 code with no noticeable change in driveability or fuel economy.
❌ Tried (didn't work) Initial dealer visit resulted in a PCM software update, but the code returned., Checking for obvious vacuum leaks., Dealer replaced the air box as a test, which did not fix it., Dealer tested the fuel in the tank, which was fine.
✅ What actually fixed it The dealer replaced the front oxygen (A/F) sensor, which resolved the lean condition and the code did not return.
"I Checked Everything" — The Actual Cause
- In a case involving a 2017 CX-5, a user reported a persistent P0171 code that appeared mostly at idle. A smoke test was performed and revealed no vacuum leaks. After replacing the O2 sensor, PCV valve, and even the high-pressure fuel pump with no success, the final solution was to replace the Mass Airflow (MAF) sensor. This indicates the MAF sensor can fail by providing inaccurate (but not entirely out-of-range) readings, causing a lean code without setting a MAF-specific DTC and without any visible vacuum leaks.
OEM Part Supersession History
Multiple, including 8py202310, 8py302310→PY01-13-111— Standard part consolidation and revision over time.
Model Year Variations Within This Range
- 2017-2021 (KF Generation): The 2017 model year marked the start of the second generation (KF). While the base 2.5L engine is fundamentally similar to the first generation (KE), it received updates. The KF generation has a more premium interior, a redesigned exterior, and features like G-Vectoring Control. The horsepower of the 2.5L NA engine was slightly increased from ~184 hp to ~187 hp. The fuel pump recall (5321K) applies specifically to 2018-2019 models within this generation.
- 2019-2021: Starting in the 2019 model year, a 2.5L turbocharged Skyactiv-G engine became an option, offering significantly more horsepower and torque. While the P0171 code applies to all engines, diagnostic paths for the turbo model may have additional components to check (e.g., turbo-related intake plumbing).
Helpful Videos
Used OEM Parts in Stock
New Aftermarket Parts Available
The information in this article is provided for general reference and educational purposes only. Vehicle specifications, procedures, and part compatibility can vary by production date, trim level, and region. Always consult your vehicle's factory service manual and verify part numbers before purchasing or performing repairs. Safety-critical components such as airbags, seat belts, and braking systems should be installed by a qualified professional.
- Mazda CX-5:
- 🎬 Helpful Videos
- 🛍️ Shop This Part
- What's Unique About the 2014-2021 Mazda CX-5
- Diagnostic Flowchart
- Symptoms You May Notice
- Most Likely Causes
- Rare But Worth Checking
- Diagnosis Steps
- Parts You'll Likely Need
- Related Codes That Often Appear With This One
- Technical Service Bulletins (TSBs) & Recalls
- Platform-Specific Known Issues
- Mechanic-Grade Diagnostic Values
- Scan Tool Commands That Help
- Real Owner Repair Stories
- "I Checked Everything" — The Actual Cause
- OEM Part Supersession History
- Model Year Variations Within This Range
- 🎟️ Get 5% Off