P0138 Mazda Code: Meaning, Causes, and Step-by-Step Scanner Diagnosis
11 min read · by Nicole Bennett · Last updated: November 25, 2026
A p0138 mazda diagnostic trouble code means the powertrain control module (PCM) has detected abnormally high voltage from the downstream oxygen sensor (Bank 1, Sensor 2) located behind the catalytic converter. Under normal operating conditions, this post-catalyst sensor reports a steady signal between 0.5 and 0.8 volts once the exhaust system reaches full operating temperature. When the voltage climbs above roughly 1.1 to 1.2 volts and stays there, the Mazda computer stores P0138 and illuminates the check engine light.
While a worn-out rear oxygen sensor is the most frequent culprit on high-mileage Mazda cars and crossovers, swapping parts without testing can waste money. A short circuit to battery power in the underbody wiring harness, a corroded engine bay ground, or an engine running genuinely rich can produce the exact same high-voltage reading. Walking through freeze frame data, live sensor graphs, and basic multimeter checks lets any DIY mechanic pinpoint the true failure before picking up a wrench.
What P0138 Means on a Mazda
Code P0138 is a generic SAE powertrain code defined as Oxygen Sensor Circuit High Voltage (Bank 1, Sensor 2), and it carries the same core definition across every OBD-II compliant Mazda sold in the United States since model year 1996. On specific platforms such as the 2008 to 2013 Mazda 6 equipped with the 2.5L L5-VE engine, Mazda PCM calibration logs P0138 whenever the rear heated oxygen sensor signal exceeds 1.2 volts for at least 0.8 seconds.
Breaking down the five characters of the code clarifies exactly which circuit triggered the alert. The letter P stands for powertrain, the first zero confirms a standard SAE fault definition, the digit 1 points to fuel and air metering, and 38 identifies high voltage on the Bank 1 Sensor 2 circuit. Because standard narrowband zirconia oxygen sensors generate their own voltage between 0.1 and 0.9 volts based on oxygen differences, a reading above 1.1 volts usually signals either an internal sensor fault or external voltage leaking into the signal wire.
Locating Bank 1 Sensor 2 on Mazda Engines
Bank 1 always designates the cylinder bank housing cylinder number one. On inline four-cylinder Mazda engines—such as the 2.0L, 2.3L, and 2.5L Skyactiv-G or MZR powerplants found in the Mazda3, Mazda6, CX-5, and MX-5 Miata—there is only one cylinder bank, so every exhaust sensor belongs to Bank 1. On V6 Mazda models like the 3.0L or 3.7L Mazda6 and CX-9, Bank 1 corresponds to the firewall-side cylinder bank containing cylinder number one, though exact sensor routing and cause frequency vary by model year and engine.
Sensor 2 is always the downstream oxygen sensor threaded into the exhaust pipe after the primary catalytic converter. Unlike Sensor 1 (the upstream air-fuel ratio or oxygen sensor mounted in the exhaust manifold before the catalyst), Sensor 2 does not actively switch back and forth every second. Instead, it measures how effectively the catalytic converter stores oxygen, while the upstream sensor handles primary closed-loop fuel adjustments. The same code can behave differently on other vehicles, so it helps to compare it with P0138 Subaru.
Common Symptoms and Driving Safety
Most Mazda drivers first notice P0138 through a solid amber check engine light on the instrument cluster without any immediate change in how the vehicle accelerates or idles. However, if the high voltage stems from an actual rich air-fuel mixture rather than an isolated sensor defect, drivability symptoms and exhaust damage can follow quickly.

- Solid Check Engine Light: The PCM turns on the malfunction indicator lamp once the high-voltage fault repeats across two consecutive drive cycles, moving the code from pending to confirmed status.
- Drop in Fuel Economy: When an upstream sensor becomes unreliable, many PCM strategies use the downstream sensor for backup fuel trim control, causing excessive fuel delivery if Sensor 2 is stuck high.
- Rough Idle or Hesitation: A genuinely rich fuel mixture can foul spark plugs, creating uneven idling at stoplights or sluggish throttle response during highway merging.
- Raw Fuel Exhaust Odor: Unburned hydrocarbons exiting the tailpipe often produce a sharp gasoline or sulfur smell after the engine warms up.
- Automatic Emissions Test Failure: Any active check engine light or incomplete oxygen sensor readiness monitor results in an instant failure during state smog inspections.
Tip: You can generally drive a Mazda short distances to a repair shop or parts store when P0138 appears alongside a steady check engine light and normal engine power. However, if the check engine light begins flashing, reduce engine load immediately and stop driving, because an active misfire can overheat and melt the internal substrate of the catalytic converter within miles. Compare the causes listed here with P0138 BMW to rule out make-specific issues.
Top Causes of P0138 on Mazda Vehicles
Determining why the rear sensor circuit exceeded 1.1 volts requires separating electrical faults from mechanical fuel-control issues. According to industry service data compiled by CarParts.com automotive technicians, four root causes account for nearly every P0138 diagnosis.
| Potential Cause | How It Triggers P0138 | Key Scanner or Meter Clue |
|---|---|---|
| Failed Downstream O2 Sensor | Internal zirconia element shorts to the 12-volt heater circuit or sticks above 1.0 volt after 60,000 to 100,000 miles of heat cycling. | B1S2 voltage stays flat above 0.9V when warm, then drops near 0V as soon as the sensor plug is disconnected. |
| Wiring Short or Corroded Ground | Melted harness insulation lets heater power touch the signal wire, or road salt corrodes the ground block beneath the airbox. | B1S2 voltage remains above 1.0V on the scan tool even with the oxygen sensor unplugged and key on. |
| Rich Air-Fuel Running Condition | Leaking fuel injector, high fuel pressure, or skewed MAF sensor leaves almost zero oxygen in post-catalyst exhaust gas. | Long-term fuel trim (LTFT) exceeds minus 10 percent and additional rich codes like P0172 appear. |
| PCM Calibration or Driver Fault | Outdated engine computer software or an internal analog-to-digital converter failure misreads a normal sensor signal. | Voltage at the PCM connector pins matches normal specs (0.5V to 0.8V) while scanner PID reads over 1.2V. |
1. Worn or Internally Shorted Downstream Oxygen Sensor
Oxygen sensors operate in extreme exhaust heat and typically last between 60,000 and 100,000 miles before degradation sets in. Every modern heated oxygen sensor houses two internal circuits inside one stainless steel shell: a 12-volt resistive heater element that warms the ceramic tip within seconds of startup, and a low-voltage sensing circuit. When internal ceramic insulation cracks, battery voltage from the heater circuit can bleed directly into the signal wire, instantly pushing the PCM reading past 1.2 volts.
2. Underbody Wiring Damage and Ground Corrosion
How to Replace Bank 1 Sensor 2 on a Mazda
Once scanner and multimeter tests confirm that the downstream oxygen sensor has failed, replacing it is a straightforward DIY job that typically takes 30 to 60 minutes with basic hand tools. Choose an OEM-grade direct-fit sensor rather than a universal splice-in unit, because Mazda PCM software expects exact heater resistance and response curves.

Safety Warning: Never work beneath a Mazda supported only by a scissor or hydraulic floor jack. Always raise the vehicle on level concrete, set the parking brake, chock the rear wheels, and lower the frame onto rated jack stands before crawling underneath. Allow the exhaust pipe and catalytic converter to cool for at least 60 minutes, as post-catalyst exhaust temperatures exceed 600 degrees Fahrenheit during normal driving. Codes often appear in groups on this vehicle, so P0171 Mazda Code may also apply.
- Soak the Sensor Bung in Penetrating Oil: Spray the threads where the downstream sensor meets the exhaust pipe with penetrating oil and let it soak for 15 to 20 minutes to break down rust and carbon deposits.
- Disconnect the Electrical Plug First: Unclip the four-pin connector from its mounting bracket and release the locking tab before turning the sensor body, preventing the harness wires from twisting or snapping.
- Remove the Old Sensor With a 22mm Socket: Slide a slotted 22mm (7/8-inch) oxygen sensor socket over the wire lead and break the sensor loose counterclockwise with a 3/8-inch or 1/2-inch breaker bar.
- Install the Direct-Fit Replacement Sensor: Verify that high-temperature anti-seize compound is applied to the threads (avoiding the slotted sensor tip), hand-thread the new sensor into the exhaust bung to prevent cross-threading, and snug it firmly with your 22mm socket.
- Route the Harness and Clear the Code: Snap the new electrical connector together until it clicks, secure every plastic retaining clip away from hot exhaust pipes, and clear P0138 using your OBD2 scanner.
Repair Cost Factors and Emissions Readiness
Total repair expense for a p0138 mazda fault depends primarily on whether you need a direct-fit sensor or underbody wiring repairs, and whether you perform the labor yourself or visit a repair shop. Replacing a downstream oxygen sensor at a professional shop typically requires brief labor time, though severe exhaust rust that requires torch heating or bung thread chasing can increase shop time.
DIY mechanics save the entire shop labor charge and pay only for an OEM-equivalent direct-fit sensor (such as Denso or NTK) plus a 22mm oxygen sensor socket if one is not already in the toolbox. If diagnostics reveal a damaged wiring harness or a leaking fuel injector instead, parts costs shift toward fuel system components or electrical splice kits and heat-shrink tubing.
Completing the Drive Cycle After Clearing P0138
Erasing P0138 with an OBD2 scanner turns off the dashboard check engine light immediately, but it also resets all emissions readiness monitors to an incomplete state. Most state emissions inspection stations automatically reject vehicles with more than one incomplete readiness monitor, and permanent trouble codes stored in newer Mazda PCMs clear only after the onboard oxygen sensor monitor runs and passes on its own. Completing mixed city-and-highway drive cycles—including a cold start, steady highway cruising, and smooth coast-down decelerations—allows the PCM to verify normal Bank 1 Sensor 2 voltage and lock in a passing readiness status. If a second code shows up during the scan, P0141 Mazda could be the next stop.
Model-Specific Notes Across Popular Mazda Vehicles
While the P0138 trouble code shares the same standardized OBD2 definition across all Mazda passenger cars and crossovers, physical access and common failure points vary slightly depending on chassis layout and engine family. Checking how the exhaust system is routed on your specific model saves time before raising the vehicle. For tools that help with this kind of work, check Best OBD2 Scanners for Shops.
- Mazda3 and Mazda6 (Skyactiv-G 2.0L and 2.5L): On front-wheel-drive sedans and hatchbacks, the underbody catalytic converter sits beneath the front floor pan. The Bank 1 Sensor 2 wiring harness routes upward through a rubber floor grommet near the center console or passenger seat track, making interior carpet inspection useful if road debris strikes the underside.
- Mazda CX-5, CX-30, and CX-9: Crossover models offer extra ground clearance for reaching the downstream sensor bung, though all-wheel-drive versions route a rear driveshaft and transfer case near the mid-pipe. Keep the replacement harness clipped securely to factory heat-shield brackets so the wires cannot contact spinning drivetrain components or hot exhaust tubing.
- Mazda MX-5 Miata: Compact exhaust packaging places the downstream sensor close to transmission tunnel heat shields, where heat soak accelerates wire insulation brittleness on higher-mileage roadsters.
Frequently Asked Questions
Can a bad catalytic converter cause a P0138 code on a Mazda?
A failing catalytic converter normally triggers efficiency code P0420 rather than P0138, because an aging catalyst lets oxygen pass through and causes the downstream sensor voltage to mimic the rapid switching of the upstream sensor instead of staying pinned above 1.1 volts.
What is the difference between P0138 and P0137 on a Mazda?
Both codes monitor the exact same Bank 1 Sensor 2 downstream oxygen sensor circuit, but P0138 indicates high circuit voltage above roughly 1.1 volts, whereas P0137 indicates low circuit voltage stuck below roughly 0.1 volts due to an open wire, exhaust leak, or lean condition.
Will disconnecting the Mazda battery permanently fix P0138?
Disconnecting the negative battery cable for 15 minutes clears volatile PCM memory and turns off the check engine light temporarily, but P0138 will return within one to two drive cycles unless the shorted sensor, damaged wire, or rich fuel fault is repaired.
Why does my Mazda use a wideband air-fuel sensor upstream and a narrowband sensor downstream?
Modern Mazda engines use a wideband air-fuel ratio sensor at Bank 1 Sensor 1 to measure exact lambda values across a broad range for precise fuel injection control, while a simpler narrowband zirconia sensor at Bank 1 Sensor 2 verifies post-catalyst oxygen storage.
Can an exhaust leak before the rear sensor trigger P0138?
An exhaust leak upstream of Sensor 2 pulls outside ambient air into the exhaust stream, which drives oxygen content up and pushes narrowband sensor voltage toward 0.1 volts (causing lean or low-voltage codes) rather than high-voltage P0138.
Diagnosing a p0138 mazda code starts with checking live Bank 1 Sensor 2 voltage and fuel trims on an OBD2 scanner before buying replacement parts. Confirming whether the signal drops near zero volts when unplugged separates a worn downstream oxygen sensor from an underbody wiring short, ensuring a clean repair that keeps your catalytic converter healthy and passes emissions testing.
-
Nicole Bennett, Technical Content Editor at BestOBD2Picks Nicole turns OBD-II standards, service bulletins, and repair data into step-by-step diagnostic guides anyone can follow. Technical Content Editor
Related guides
LearnP0135 Mazda: Diagnose the Oxygen Sensor Heater Circuit
LearnP0125 Mazda: Diagnose Coolant Warm-Up Problems and Restore Engine Performance
LearnP0121 Mazda: Diagnose Throttle Problems and Restore Performance
LearnP0118 Mazda: Diagnose Coolant Sensor Problems and Prevent Engine Damage
LearnP0108 Mazda: Diagnose MAP Sensor Circuit High Input and Restore Engine Performance
Learnp0121 honda: Diagnose Throttle Sensor Problems and Restore Smooth Acceleration