Joining to a team doesn't give you this error message at all
Example command: (you won't get anything in chat)
/scoreboard teams join Team @e[type=!Player,r=0]
Leaving a team gives the error message only for the first selector.
Example command: (you'll leave from any teams you've been before, but you won't get the error message for the second selector)
/scoreboard teams leave @p @e[type=!Player,r=0]
Linked issues
Comments 5
You got that error message because the first selector (@p) tried to remove you from a team but you wasn't in any team.
Probably happens for all commands which do not run for every specified entity but for multiple entities only once. Might be only these two at the moment.
Relates to MC-106681 and MC-99758