Odd..I literally posted the lean bank code in another thread.
P0171 Lean Bank 1 sound familiar?
Typical causes of this code (I always find new ways to have it pop up
1. Check your battery connectors to be clean, tight and in good condition. Pull the cable, check under the boots.
2. Check to ensure your evap lines are properly routed to the evap switch/soleniod. Reversing them will cause this code.
3. Check your maf, the fsm loves to blame the maf for this code...I've yet to see it be the cause on my car.
I can't stress #1 quite enough. My cables were replaced from being corroded internally and causing the problem.