For his error - The Hebrew is difficult, and some prefer the reading of the parallel passage, “because ... ask” 1 Chronicles 13:10.
Related Commentaries of 2 Samuel 6:7
2 Samuel 6:7
7 And the anger of the LORD was kindled against Uzzah; and God smote him there for his error;c and there he died by the ark of God.