You did not commit a sin because you need matter, form and intent.
I think that you are mistakenly conflating what is necessary for the validity of a Sacrament with the requisites to being guilty of committing a mortal sin.
Sacramental validity: valid minister, proper matter, proper form, and intent.
Mortal sin: grave matter, knowledge, and full consent.