The idea that prophets or their writings are infallible is an old sectarian notion and is false. “All have sinned, and come short of the glory of God” (Romans 3:23).
Elijah, we are told, “was a man subject to like passions as we are” (James 5:17). When an attempt was made to worship Paul and Barnabas as gods they forbade the people, saying, “We also are men of like passions with you” (Acts 14:15).
Never has there been a prophet who has been excused from the frailties and temptations of the flesh. We see in Nephi a keen sensitivity to his weaknesses and a spirit that “could not look upon sin save it were with abhorrence” (Alma 13:12).