Hi!
You might be facing restrictions due to your account type. Is your account a child account, or are you a minor?
Have you checked your Xbox privacy settings?
Does the error occur in all worlds or only in specific types (e.g., Realms, external servers, or a friend's world)?
Does the account have an active Game Pass or Xbox Core subscription?