P0171 on 2014-2021 Mazda 6 2.5L SkyActiv-G: Causes for System Too Lean Code and Fixes
P0171 on a Mazda 6 SkyActiv engine is most often caused by a dirty Mass Airflow (MAF) sensor or a vacuum leak from a failed intake manifold gasket. Start by cleaning the MAF sensor; if that doesn't work, a smoke test is needed to find the vacuum leak. Also, check that the air filter box lid is properly sealed, as this is a common oversight.
- Code P0171 means your Mazda 6's engine is running lean (too much air, not enough fuel).
- The most likely causes are a dirty MAF sensor or a vacuum leak from the intake manifold gaskets.
- Start your diagnosis by cleaning the MAF sensor with a dedicated cleaner—it's a cheap and easy first step.
- Do not replace the oxygen sensor first; it is usually just reporting the problem, not causing it.
- If basic checks fail, a smoke test is the best way to find a hidden vacuum leak.
What's Unique About the 2014-2021 Mazda 6

While the causes for P0171 are common across many vehicles, the 2.5L SkyActiv-G engine has specific weak points. Vacuum leaks from hardened intake manifold gaskets are a known, well-documented issue on this platform and its mates like the CX-5. Additionally, Mazda has issued a Technical Service Bulletin (TSB MT-021/17) that applies to the 2014-2021 Mazda 6, which points to faulty fuel injectors as a potential root cause if other common fixes fail. Manufacturer service bulletin TSB Bulletin #MT-004-22 also notes that vehicles may experience the Check Engine Light with P0171 occurring alongside misfire codes (P030X).
Symptoms You May Notice
- Check Engine Light is on
- Rough or unstable idle, RPM may fluctuate at stops
- Engine hesitation or lack of power during acceleration
- Reduced fuel economy
- Hissing noise from the engine bay, indicating a vacuum leak
- Engine stalling, especially when stopped or at low speeds
- In some cases, the issue is more pronounced when the fuel tank is less than half full, which may point towards a weak low-pressure fuel pump.
- Replacing the oxygen sensor first. The O2 sensor is often just reporting the lean condition, not causing it. Vacuum leaks and MAF sensor issues are more common culprits and should be checked first to avoid wasting money on a new sensor.
Most Likely Causes


- Dirty or Faulty Mass Airflow (MAF) Sensor 🔴 High Probability The MAF sensor measures the air entering the engine. If it gets dirty with oil or dust, it under-reports the amount of air, causing the PCM to inject too little fuel. This is a very common and easy first check.
How to confirm: Unplug the MAF sensor while the engine is idling. If the idle smooths out, the MAF sensor is likely the culprit as the engine switches to a default fueling map. You can also visually inspect the sensor for dirt and clean it with a dedicated MAF sensor cleaner. A scan tool showing g/s readings significantly below 2.0 g/s at warm idle could also indicate a faulty sensor.
Typical fix: Clean the sensor with MAF sensor cleaner. If cleaning doesn't resolve the issue, the sensor must be replaced. 🎬 See this walkthrough on replacing your Skyactiv MAF sensor
Est. part cost: $15-$250 - Vacuum Leak (Intake Manifold Gasket) 🔴 High Probability The intake manifold gaskets on the SkyActiv engine are a known failure point. Over time, they can become brittle from heat cycles, crack, and allow unmetered air to enter the engine, causing a lean condition. This is arguably the most common cause on this platform after the MAF sensor.
How to confirm: Listen for a hissing sound from the engine bay at idle. A definitive diagnosis is made with a smoke test, which will clearly show smoke escaping from the failed gasket seals. Another method is to spray brake cleaner or a similar combustible fluid near the gasket with the engine running; a change in idle indicates a leak.
Typical fix: Replace the intake manifold gasket set (four individual gaskets). This is a one-time-use part and must be replaced anytime the intake manifold is removed.
Est. part cost: $20-$40 - Sticking EVAP Purge Solenoid Valve 🟡 Medium Probability The EVAP purge valve controls the flow of fuel vapors from the charcoal canister to the intake manifold. If it sticks open, it creates a constant vacuum leak, which can trigger a P0171 code.
How to confirm: With the engine running, disconnect the vapor line from the purge valve and feel for suction at the valve's port. If there is a vacuum present at idle when the valve should be closed, the valve has failed. 🎬 Watch: How to replace a faulty purge valve solenoid
Typical fix: Replace the EVAP purge solenoid valve.
Est. part cost: $50-$140 - Failing Upstream Oxygen (A/F) Sensor ⚪ Low Probability The upstream oxygen sensor (also called an Air/Fuel ratio sensor) provides the primary feedback for the air-fuel mixture. If it becomes slow or biased, it can send incorrect information to the PCM, causing a lean code. However, this is less common than MAF or vacuum issues and should be diagnosed last.
How to confirm: Use a scan tool to monitor the sensor's voltage. A healthy sensor's voltage will fluctuate rapidly. A slow or stuck reading indicates a problem. This should only be diagnosed after ruling out vacuum leaks and MAF sensor issues.
Typical fix: Replace the upstream oxygen sensor.
Est. part cost: $80-$200
Rare But Worth Checking
- Clogged or Faulty Fuel Injectors: Mazda TSB MT-021/17 specifically lists replacing the fuel injectors as the final repair step if checks of the airbox, MAF sensor, and A/F sensor do not resolve a persistent P0171 code. This indicates it's a known, factory-acknowledged, though less common, failure path.
- Low Fuel Pressure: A weak fuel pump or a clogged fuel filter can restrict fuel flow, leading to a lean condition. While less common on this platform than other causes, it can still occur, especially on higher mileage vehicles. Some 2018 models were subject to a recall for a faulty low-pressure fuel pump. NHTSA ODI #11505265 describes a situation where a vehicle threw P0171 and P0192 due to a defective fuel pump.
- Improperly Seated Air Filter Box: A surprisingly common issue after an air filter change. The air filter housing has tabs on the rear that must be seated correctly. If they are not, the lid will not seal, creating a large unmetered air leak just before the MAF sensor, triggering P0171. Always check this simple fix first.
Diagnosis Steps

- Read the code with an OBD-II scanner and check for any other stored codes. Note the Long Term Fuel Trim (LTFT) and Short Term Fuel Trim (STFT) values. A high positive LTFT (e.g., +20% or more) confirms the lean condition.
- Inspect the air intake system, paying close attention to the air filter box lid to ensure it is fully seated and latched correctly. Check the intake boot between the MAF sensor and the throttle body for any cracks or loose clamps.
- Visually inspect and listen for obvious vacuum leaks around the intake manifold, PCV hoses, and other vacuum lines. A hissing sound is a common indicator.
- Clean the Mass Airflow (MAF) sensor using a dedicated MAF sensor cleaner. Do not touch the delicate sensor wires.
- With a scan tool monitoring fuel trims, raise the engine RPM to 2500-3000 and hold it. If the STFT and LTFT values decrease significantly toward zero, a vacuum leak is the most likely cause. If the fuel trims remain high, the problem is more likely related to the MAF sensor or fuel delivery.
- If a vacuum leak is suspected but not found, perform a smoke test on the intake system. This is the most effective way to locate hard-to-find vacuum leaks, especially from the intake manifold gaskets.
- If no vacuum leaks are found, use a scan tool to monitor oxygen sensor data. A lazy or biased upstream O2 sensor may be the cause.
- Check fuel pressure to ensure the fuel pump and filter are providing adequate fuel flow. Note any recalls on 2018 models for the low-pressure fuel pump. NHTSA ODI #11523568 reports a mechanic finding P0171 alongside P0192 for low fuel rail pressure.
- If all other diagnostics fail, consider the possibility of faulty fuel injectors as outlined in Mazda TSB MT-021/17.
Parts You'll Likely Need

- Mass Airflow (MAF) Sensor
(OEM #PE01-13-215)— This sensor is a primary cause of P0171 when it becomes dirty or fails, providing incorrect airflow data to the engine computer. Cleaning is a first step, but replacement is common.
Trusted brands: Denso, Hitachi, Mazda (OEM)
OEM price range: $200-$250
Aftermarket price range: $100-$180 - Intake Manifold Gasket Set
(OEM #PE01-13-111)— These gaskets are a known failure point on the SkyActiv engine, becoming brittle and causing vacuum leaks that trigger P0171. Four are required.
Trusted brands: Fel-Pro, Mahle, Mazda (OEM)
OEM price range: $30-$40
Aftermarket price range: $20-$30 - EVAP Canister Purge Valve
(OEM #PE01-18-751)— A common failure where the valve sticks open, creating a persistent vacuum leak.
Trusted brands: Standard Motor Products, Dorman, Mazda (OEM)
OEM price range: $90-$140
Aftermarket price range: $50-$80
Related Codes That Often Appear With This One
- P0300-P0304 — A lean air-fuel mixture can cause incomplete combustion, leading to random (P0300) or cylinder-specific (P0301-P0304) misfires. Mazda TSBs explicitly note that P0171 may appear with these codes. TSB Bulletin #MT-004-22 confirms that P0171 may be accompanied by DTCs P030X.
- P2187 — This is a Mazda-specific code for 'System Too Lean at Idle (Bank 1)'. It often appears with P0171 and strongly points towards a vacuum leak as the cause, since leaks have a more significant effect at idle RPM when engine vacuum is highest.
Technical Service Bulletins (TSBs) & Recalls
- MT-021/17
- TSB Bulletin #MT-004-22: Outlines inspection and repair procedures for vehicles experiencing P0171 and potential misfire codes.
Platform-Specific Known Issues
- Improperly Seated Air Filter Box: A common user error after changing the air filter is failing to properly seat the rear tabs of the air filter box lid. This creates a significant air leak right before the MAF sensor, leading to a P0171 code. One owner on a forum noted this was the simple solution after extensive troubleshooting.
Mechanic-Grade Diagnostic Values
- Mass Airflow (MAF) Rate at Idle — expected: ~2.0-2.5 g/s at warm idle for the 2.5L engine.. Failure: A reading significantly higher than 3.0 g/s at idle can indicate a faulty sensor or a large vacuum leak. A reading of ~3.8 g/s was reported by one owner with a persistent P0171.
- Long Term Fuel Trim (LTFT) at Idle — expected: Within +/- 10%.. Failure: A sustained positive value of +20% or higher indicates the PCM is compensating for a lean condition and will trigger the code.
- High-Pressure Fuel Rail Pressure (Direct Injection) — expected: ~3100 kPa (approx. 450 PSI) at idle.. Failure: Significantly lower pressure could indicate a failing high-pressure or low-pressure fuel pump.
- EVAP Purge Solenoid Resistance — expected: Approximately 30-38 ohms at room temperature.. Failure: An open (OL) or shorted (zero) reading indicates a failed solenoid coil.
Scan Tool Commands That Help
- FORScan / Advanced OBD-II Scanners: EVAP System Test (Purge Valve Control) — This bidirectional command allows the technician to manually open and close the EVAP purge solenoid valve to confirm if it is mechanically stuck open (creating a vacuum leak) or if it is failing to respond to the PCM's command.
- Mazda IDS / FORScan: Clear/Reset All Adaptations — After replacing a major sensor like the MAF, resetting learned fuel trim values forces the PCM to immediately re-learn based on the new sensor's data, which can resolve a persistent code if old data was skewed.
Real Owner Repair Stories
- YouTube (2016 Mazda 6) — Check engine light for P0171, engine shaking, misfiring, poor acceleration, hesitation, and stalling at idle.
❌ Tried (didn't work) Replaced all ignition coils, Replaced all spark plugs, Performed a smoke test (no leaks found)
✅ What actually fixed it The owner had already replaced the MAF sensor with a new aftermarket part. The final fix was replacing the *new, but defective* aftermarket MAF sensor with another brand new one. The first replacement part was faulty out of the box. - Reddit user 'bootymuncher4900000' (2016 Mazda 6 Sport, 106k miles) — Persistent P0171 code.
❌ Tried (didn't work) Replaced both oxygen sensors, Replaced purge valve, Replaced MAF sensor, Performed a smoke test for vacuum leaks, Used fuel injector cleaners, Replaced the entire fuel pump based on a dealer diagnosis
✅ What actually fixed it The user did not post a final resolution, serving as a cautionary tale about replacing parts without a definitive diagnosis. - YouTube (Mazda with SkyActiv engine) — P0171 lean code, comeback after previous repair attempt.
❌ Tried (didn't work) Thorough smoke test (passed, no leaks found)
✅ What actually fixed it The MAF sensor screws were stripped, and the sensor was not sitting flush in the airbox, creating an unmetered air leak. The fix was to repair the screw holes and properly secure the MAF sensor.
"I Checked Everything" — The Actual Cause
- A technician on YouTube documented a case on a Mazda where a smoke test passed with no leaks found. The ultimate cause of the P0171 was a MAF sensor that was not properly secured in the airbox because the screw holes were stripped. This allowed unmetered air to be drawn in around the sensor, but the leak was too subtle for the smoke test to reveal.
- In another case, a user on a Mazda forum passed a smoke test but continued to have a P0171 code. The final fix was replacing the Mass Airflow (MAF) sensor itself, which was faulty but not setting its own specific code.
- NHTSA ODI #11517077 describes a case where a dealership identified that a P0171 code was caused by a damaged fuel pump that sent debris into the high-pressure pump.
OEM Part Supersession History
PE01-13-215→No clear supersession found, this part number appears to be consistent.— N/A
Heads up: The same part number PE01-13-215 is listed for a wide range of Mazda vehicles from 2012-2021, including the Mazda 3, 6, CX-3, CX-5, and MX-5 with SkyActiv engines.
Model Year Variations Within This Range
- 2018-2021: For the 2018 model year, Mazda introduced an optional 2.5L turbocharged Skyactiv-G engine for higher trims (Grand Touring, Grand Touring Reserve, Signature). While the base engine remained the same non-turbo 2.5L, diagnostics on a turbo model could have additional considerations (e.g., turbo-related intake leaks). The non-turbo 2.5L also received cylinder deactivation in 2018.
- 2018-2019: Certain 2018-2019 models were part of a recall (Mazda recall 5321K) for a faulty low-pressure fuel pump that could cause stalling and lean conditions, making it a primary suspect for P0171 on these specific years.
Diagnostic Flowchart
Other Known Issues on This Vehicle
Issues unrelated to this code that are worth knowing about as an owner of this generation:
- Infotainment 'Ghost Touch' and Delamination 🟠 Medium — Very common, especially on 2016-2018 models. Caused by heat and humidity causing the screen's digitizer layer to fail, resulting in phantom inputs. Often gets worse in warm weather. (Ref: No specific recall, but widely acknowledged. A class-action lawsuit led to a warranty extension (CSP13) for the Connectivity Master Unit (CMU), but this often doesn't cover the screen itself.)
- Premature Wheel Bearing Failure 🟠 Medium — Commonly reported issue where wheel bearings become noisy and fail at relatively low mileage (sometimes under 60,000 miles). (Ref: Mazda has issued multiple TSBs (e.g., SA-006-22, SA-016-19) acknowledging that wheel bearing noise can be misdiagnosed as transmission or differential issues.)
- Intake Valve Carbon Buildup 🟡 Low — As a direct-injection (GDI) engine, the SkyActiv-G is susceptible to carbon deposits on intake valves over time, as fuel does not wash over them. While Mazda's design mitigates the worst of it, it can still occur, especially with extensive short-trip driving. It is not considered a critical, widespread problem compared to other GDI engines.
- Water Pump Failure 🟡 Low — Some owners have reported coolant leaks from the water pump failing prematurely, typically before 100,000 miles.
- Failing High-Pressure Fuel Pump 🟡 Low — While not as common as the P0171 causes, the mechanically driven high-pressure fuel pump can fail, leading to a loss of power and stalling. This is a more expensive repair.
Used vs. New Parts: Buying Guide for This Vehicle
When a used part is the smart pick: For this repair, used parts are generally not recommended for the most common failure items. Gaskets must be new. Sensors are high-risk used purchases. A complete used air filter box assembly could be a cost-effective way to fix stripped MAF sensor screw holes, but the included sensor should be considered suspect.
Donor-vehicle mileage cap: roughly under 75000 miles for the part to have meaningful remaining life.
What to inspect on the donor part:
- For an airbox, check for intact mounting points and non-stripped screw holes.
- Ensure the intake boot is free of cracks, especially in the accordion-like flex sections.
- Avoid parts from vehicles with obvious signs of front-end collision or engine fires.
OEM-only on this vehicle (don't cheap out):
- Mass Airflow (MAF) Sensor: Given at least one documented case of a new aftermarket MAF being faulty out of the box, and the sensor's critical role, sticking with a genuine Mazda, Denso, or Hitachi part is the safest, most time-efficient choice.
Aftermarket brands forum-validated for this vehicle:
- Intake Manifold Gaskets: Fel-Pro and Mahle are reputable brands for gaskets and are considered reliable alternatives to OEM.
Brands owners have reported issues with on this vehicle:
- Unbranded/white-box MAF sensors from online marketplaces have a higher risk of being defective on arrival or having a short service life.
Real Owner Stories
Aggregated from forums and TSBs cited above. Mileages and costs reflect what owners reported in those sources.
2016 Mazda 6 2.5L
Symptoms: The owner experienced a 'mystery' P0171 code and underwent an exhaustive and expensive repair process including replacing O2 sensors, the purge valve, the MAF sensor, and the fuel pump based on a dealer diagnosis, yet the issue persisted.
What fixed it: The source highlights that the issue remained unresolved because the root cause (likely the intake gaskets) was missed during the initial diagnostic process.
Source hint: Reddit - r/mazda6 - 'Please, how to solve mystery p0171 code'
2013 Mazda CX-5 2.5L (Platform Mate)
Symptoms: Check engine light with P0171 code after a service visit.
What fixed it: Discovering the air filter box cover was not closed correctly by a service technician, with the rear tabs not in their slots.
Source hint: YouTube - 'P0171 Code Mazda CX-5 2013 - Solved' (Comment Section)
2020 Mazda CX-5 2.5L (Platform Mate)
Symptoms: P0171 error code where the cause was difficult to locate through standard inspection.
What fixed it: The source reinforces checking for vacuum leaks via a smoke test or by spraying brake cleaner near vacuum connections to identify leaks in components like the intake manifold gaskets.
Source hint: Mazdas247 - 'P0171 Error 2020 CX-5 Can't find cause'
Documented NHTSA Reports
NHTSA ODI #11517077
Symptoms: An owner reported running issues while driving at 5 miles per hour.
What fixed it: A Mazda dealership determined the P0171 code was caused by a damaged fuel pump that had sent debris into the high-pressure pump.
NHTSA ODI #11523568
Symptoms: A vehicle was reported as not starting correctly and lacking RPM power.
What fixed it: A mechanic used a code scanner and found P0171 (System too lean) alongside P0192 (low fuel rail pressure).
NHTSA ODI #11505265
Symptoms: A vehicle stalled and would not restart.
What fixed it: Diagnostic review found codes P0192 and P0171, which the report attributes to a known issue with defective fuel pumps.
Related OBD-II Codes
Frequently Asked Questions
Could a recent air filter change on my Mazda 6 be causing the P0171 code?
Is there a specific TSB for fuel injector issues on the 2.5L SkyActiv-G engine?
Why does my Mazda 6 idle roughly and stall more often when the fuel tank is low?
Are the intake manifold gaskets a known failure point for the 2014-2021 Mazda 6?
How can I tell if my MAF sensor is the cause of the P0171 code?
Can a faulty EVAP component cause a lean condition on this platform?
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 6:
- 🎬 Helpful Videos
- 🛍️ Shop This Part
- What's Unique About the 2014-2021 Mazda 6
- 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
- Diagnostic Flowchart
- Other Known Issues on This Vehicle
- Used vs. New Parts: Buying Guide for This Vehicle
- Real Owner Stories
- 2016 Mazda 6 2.5L
- 2013 Mazda CX-5 2.5L (Platform Mate)
- 2020 Mazda CX-5 2.5L (Platform Mate)
- Documented NHTSA Reports
- NHTSA ODI #11517077
- NHTSA ODI #11523568
- NHTSA ODI #11505265
- Related OBD-II Codes
- Frequently Asked Questions
- 🎟️ Get 5% Off