Ask a VW Question, Get an Answer ASAP!
For p0171 this a lean code you need to check all the vacuum lines that connect to the engine this is the most common cause of this. If you cannot find any vacuum lines that are broken then the second most common problem would be a Mass Air Flow sensor.
The p0340 fault is usually seen after a timing belt replacement and the timing is off a tooth. Have you had the timing belt replaced recently. If not then your belt tensioner may have malfunctioned and caused slack in the belt, but 99 times out of 100 it is the timing belt being off of time.