P0171 - System Too Lean

The trouble code P0171 - System Too Lean (Bank 1) means that the air-fuel mixture coming into the engine is too lean, or there is too much air and too little fuel. The code P0174 - System Too Lean (Bank 2) means the same, only for the cylinder Bank 2.

How the code P0171 is set If the air-fuel mixture becomes too lean and the engine computer can no longer compensate this condition by adding fuel, the engine computer (ECM) turns the "Check Engine" light (MIL) and sets the trouble code P0171 - System Too Lean for Bank 1 and (or) P0174 - System Too Lean Bank 2, depending on which cylinder bank is affected. The ECM also stores the freeze frame of the parameters (engine temperature, vehicle speed, fuel trim readings, etc.) at the time when the code was set. Typically the code P0171 is set when either short term fuel trim (STFT) or long term fuel trim (LTFT) adjustment exceeds a certain value (usually +25%). Read more how the air/fuel ratio control works below.

What can cause the code P0171 or P0174 The trouble code P0171 means that the air-fuel mixture coming in to the engine is too lean, or there is too much air and too little fuel. The lean condition could be caused by a number of reasons, such as vacuum leaks, bad airflow sensor, plugged fuel filter, clogged fuel injectors, low fuel pressure, exhaust leaks, a bad PCV valve, bad oxygen sensor, stuck open purge valve, etc.
Vacuum leaks are very common. Here is a few of examples:
1. Cracked vacuum hoseCracked vacuum hoseCracked vacuum hose  
2. Disconnected vacuum lineDisconnected vacuum lineDisconnected vacuum line
3. Cracked vacuum lineCracked vacuum lineCracked vacuum line
Some of the signs that a car has a vacuum leak are the engine running rough or unstable at idle and hissing sound coming from the engine.
For example, a Toyota Technical Service Bulletin (TSB) EG045-07 for 2003-2008 Toyota Corolla and 2003-2008 Toyota Matrix mentions a leaking intake manifold gasket as a possible reason for the code P0171 along with some other codes.

Aiflow sensor

Mass air flow sensor

Many Ford vehicles, including Explorer and F150 had a common problem with leaking gaskets between upper and lower intake manifolds causing the codes P0171 and P0174. Ford has issued a Technical Service Bulletin on this issue. Another known issue in Ford vehicles is a vacuum leak from a ripped through rubber elbow on one of the vacuum lines in the back of the intake manifold.
Problems with a mass air flow (MAF) sensor are fairly common too. Sometimes the mass air flow sensor just gets dirty and gives false air flow readings causing the engine to run lean and the code P0171. For example, a friend of mine had a Check Engine light in his 2000 Toyota Corolla. We connected the scan tool and retrieved the trouble code and it was the P0171. We checked the air flow sensor readings, and they were lower than usual. Cleaning the air flow sensor helped for a while, but when the same code came back in a few months, we replaced the air flow sensor with a new part bought from a dealer and it fixed the problem.
A Nissan TSB for Nissan Maxima dated March 2004 mentions replacing an Air/Fuel sensor as a solution for the code P0171. Another Ford TSB for a number of late 90-s Ford vehicles describes a problem with MAF sensor contamination where both codes, P0171 and P0174 would appear together.
If you have the code P0171 in your car, your mechanic may need to scan your vehicle to check the freeze frame, test the air flow sensor, check for vacuum leaks, etc. The cost of repair depends on the cause. If it's just a vacuum leak at one of the vacuum lines, it's a very simple repair.

How the air/fuel ratio is controlled, what is a fuel trim: In modern cars with the OBD-II system, the engine computer (ECM) constantly monitors the signal from the front oxygen sensor (front O2 sensor), installed in the exhaust.

Fuel trim Control diagram - OBD II system

Fuel Trim Control diagram

The front oxygen sensor measures the amount of the oxygen in the exhaust gases and provides the feedback signal to the engine computer (ECM) whether the air-fuel mixture coming into the engine is lean (too much air and too little fuel) or rich (too much fuel and too little air).
The ECM adjusts the fuel supply to keep the air/fuel ratio at the optimum level, which is usually 14.7/1. If the oxygen sensor detects too much oxygen, the ECM assumes that the air/fuel mixture is lean and adds more fuel. If there is too little oxygen in the exhaust (air/fuel mixture is rich), the ECM reduces the amount of fuel. In technical language this adjustment is called fuel trim.

Short term fuel trim (STFT) Once the front oxygen sensor is warmed up after a cold start, the engine computer (ECM) starts cycling the air/fuel ratio between a little lean and a little rich. This cycling happens around once or twice per second. This air/fuel ratio adjustment is called short term fuel trim (STFT). You can see this cycling on the graph here: oxygen sensor

Long-term fuel trim (LTFT) There is also a long-term fuel trim (LTFT), which is a compensation of the base air/fuel ratio for the changes that happen in a long term. For example, if over time, the engine gradually develops a small vacuum leak, it makes the engine to run leaner (more air and less fuel). In a long term, the engine computer (ECM) compensates this condition by adjusting the long term fuel trim (LTFT), to add more fuel. Both, the short-term fuel trim and long-term fuel trim are displayed as a percentage with "-" or "+" sign in a scan tool. For example, a Long-term fuel trim (LTFT) at +5% means that the ECM added some fuel, although 5% is considered within normal range.

Bank 1, Bank 2

v6 engine

Typically, the engine bank that
contains cylinder 1 is called Bank 1

The term Bank 1 usually refers to a bank of the engine that contains the cylinder number 1. In an in-line 4-cylinder engine, there is only one bank (Bank 1).
A V6 or V8 engine has two banks, each with three or four cylinders respectively. Usually, in a V6 or V8 engine, the bank that contains the cylinder 1 is called Bank 1 and the opposite bank is called Bank 2. To know which is Bank 1 and Bank 2, you can look it up in a repair manual or you can always google it, mentioning the year, make, model and engine size of your car.

Q: What could cause the code P0171 on 2002 Toyota Corolla?

A: In the 2002 Corolla, the code P0171 is often caused by a bad or dirty mass airflow sensor or vacuum leaks. Your mechanic can check for vacuum leaks and test the mass airflow sensor with a scan tool. If the mass airflow sensor is causing the lean condition, cleaning it may help, but usually, it will need to be replaced. There also could be some other reasons, but the air flow sensor and vacuum leaks are the most common.

Q: 2004 Ford Taurus, getting codes p0430, p0300 & p0174

A: The code P0300 means that multiple cylinders are misfiring. This very well could be caused by the code P0174 System Too Lean (Bank 2). The code p0430 Catalyst System Efficiency Below Threshold (Bank 2) means that the catalytic converter for the bank 2 doesn't work properly. This also could be a result of the same problem that caused the code P0174. I'd start from the code P0174. Often this code could be caused a vacuum leak (e.g. from intake plenum gasket, PCV hose, vacuum lines) which is not uncommon in Ford vehicles, although there are plenty of other possible reasons, like low fuel pressure, MAF, etc.; read more above. There was also a Ford TSB recommending re-flashing the engine computer, I'd also check if this bulletin applies to your vehicle. By the way, a catalytic converter could be still covered by the 8 years/80000 miles emission warranty, I'd certainly check it with a Ford dealer.