In some topics it’s not possible to invite another user to the conversation. This happens when it’s in a category that is not open to everyone, which might make some sense in the case of something like a Regulars Lounge category. However, if a category is just not visible to anonymous users (but even a TL0 can Create / Reply / See in it), that already prevents inviting other users to the topic.
I think the logic being applied is to prevent someone from sharing a link / invite by email (which makes sense) but is also preventing inviting existing users by their username.
Does this happen for all users?
Users with a TL0 or TL1 cannot invite others and won’t be shown the invite link. Only TL2 or above can send invites and get shown the invite button.
I can reproduce this on my local development site. Even as an admin user, when I set a category’s security permissions to Trust Level 0 can Create / Reply / See, the share dialog doesn’t give me an option to send an invite. I think that Discourse is trying to prevent invites being sent to topics that a user may not have permissions to access, but all users on the site will have TL0 status, so preventing invites from being sent doesn’t make sense for this case.