Of course, I am only hearing one side of the story, but if this type of thing happens a lot, then I'm like you, I'd be beginning to wonder what is happening and if it might be me.
That does sound mean to invite you and then "de-invite" you.
Are you in therapy? That would be one way to get some feedback and some help with relationship skills, if it does turn out to be something you're doing.