Rashi to Shmuel 2 6:3 says that David sinned when he wrote Tehillim 119:54. When people recite Tehillim, they are saying something sinful. Should this verse not have been removed from Tehillim 119?
Devorah is criticised for praising herself in her song. Should the offending verse not be removed?
This is an interesting question. The Yalkut Me’am Loez on this verse explains that there is nothing wrong with the verse itself, as its meaning was that David was saying that although he was constantly running around from place to place, still the depths of the torah were a pleasure for him to delve into. The fact that the torah was a song was not the problem with what David said, as R’ Akiva (Sanhedrin 98b) also said that the torah should be like a song and this way you will get to olam haba, because when the torah is organized and clear in the persons had he will remember it like a song. So what was the sin? The answer is that there was a tinge of haughtiness is the terminology by saying that the torah was like a song (and clear) to me, and he shouldn’t of said that in public. Since he said that the torah is clear to him inappropriately he was punished by forgetting something. The fact that we say this posuk is not a problem since the main part of it is the praise that he is saying about the love for torah. Another reason it is not a problem for us to say it , is because even the sin is a lesson for us to learn, therefore the verse is specifically there for us to see and learn. It would be the same for Devorah. The torah mentions many of the iniquities of the greatest of people, even if the “sin” was very slight, in order to be a lesson for future generations.