Hi thank you for your question. My name is ***** ***** I am a fully qualified technician I will try and help you.
The engine management light can come on for a number of reasons but i see you have a code which is good.
The code P0171 indicates that the system has detected a weak mixture. The most likely cause of this would be an air leak into the manifold, this may be a hose or less likely a failed gasket.
Another common cause of this code is a leak in the exhaust system, this gives a false reading to the 02 sensor by allowing air into the system.
Or the problem may be a faulty 02 sensor.
Other causes could be a failing injector or MAF sensor, but these are less likely.
So the way I would address the problem would be to first check for ant air leaks into the manifold, you may hear a sucking noise with the engine running.
If you can find no air leaks check for an exhaust leak, this doesn't have to be large to effect the reading.
If after this you have not found a cause then as the engine is running ok, the most likely cause would be the 02 sensor.
I hope this helps but do please feel free to ask any further questions. If happy with my answer please click accept and rate me. Even after you have done this i will be able to answer any further questions you have.