Diagnostic fault codes never say to replace parts. While it's true replacing a sensor solves the problem about half the time, the code means that is the circuit or system that needs further diagnosis. You can have wiring and connector problems or a condition the sensor picked up that is incorrect.

Randomly throwing parts at a problem in hopes one solves it is by far the most expensive and least effective way to diagnose a problem, plus it introduces new variables each time to confuse the Engine Computer even more.