The dangers of idolizing Mormon prophets

The Church teaches us on the one hand that a living prophet is more valuable to us than even the scriptures (!), and instructs Primary children to follow the prophet and never “go astray.” But then it also tries to emphasize that a prophet is only a prophet “when he is acting as such,” and that not every teaching is doctrine. Which is it?