2010 HHR LT 2.2 has had funny idle with occasional stalling. Had oil changed last Sunday and noticed the air intake hose connecting fender to filter box was unraveling so my Daddy took it off and i drove it like that. 3 days later on Wednesday my car wouldn't start and had an insane rattle for a few seconds when it finally started. My Daddy said it was the starter. Later that day it started to stall again while i was on my mail route and i couldn't let it die cause i hadn't got the starter fixed yet so i quit my route amd went straight to my daddy so he could put a starter on it. When I left my daddy's the CEL was on. The next day on my way to work it was driving fine (10 min drive to work) I stopped at Advance Auto along the way to have them scan it and its throwing codes P0171 and P0326. The car continued to drive fine until I was about an hour into my route then it started having lack of power on take off every time I stopped and started to stall once but it didn't. So quit my route again and went straight to my daddy's. He seemed think it was my fuel pump but fuel PSI is 60. He put a new intake hose it where it was left off a few days before. I'm not sure if the intake hose being left off could be the issue or not, haven't drove since.
The P0171 code indicates there is a vacuum leak. P0326 is a knock sensor fault code. The P071 needs to be addressed first. Have your Dad do a thorough inspection for a vacuum leak. They are found in vacuum lines and intake manifolds. This is the first place to look. Hopefully he can find a vacuum leak, repair it and the knock sensor fault will disappear as a result. If there truly is not a vacuum leak, the fuel supply needs to be monitored. Checking fuel regulation and injector performance would be next. Then the ignition components need checked. Plugs coils and wires if applicable. Then a compression test. Since there are no misfire codes I would suspect that the problem will be taken care of by fixing a vacuum leak.