Шулхан арух
The "Shulchan Aruch" is largely based on an earlier work by Karo, titled "Beit Yosef". Although the "Shulchan Aruch" is largely a codification of the rulings of the "Beit Yosef", it includes various rulings that are not mentioned at all in the "Beit Yosef", because after completing the "Beit Yosef", Karo read opinions in books he hadn't seen before, which he then included in the "Shulchan Aruch". In his famous methodological work "Yad Malachi", Malachi ben Jacob ha-Kohen cites a later halachic authority (Shmuel Abuhab) who reports rumors that the "Shulchan Aruch" was a summary of Karo's earlier rulings in Beit Yosef which he then gave to certain of his students to edit and compile. He concludes that this would then account for those seemingly self-contradictory instances in the "Shulchan Aruch".