Thank you for the explanation. I now understand that entities can only be on one team, so team=X is exhaustive—just like type—and any additional team argument after it should be rejected.
However, the issue I’m trying to highlight is the inconsistency in how the parser handles the order. Currently:
@a[team=!Y,team=X] (exhaustive team=X comes second) does not reject the duplicate argument and incorrectly matches players.
@a[team=X,team=!Y] (exhaustive team=X comes first) correctly rejects with Option 'team' isn't applicable here.
Since the exhaustive condition determines that no further team arguments can be meaningful, the command should fail regardless of which order the arguments appear in. The current behavior treats the two orders differently, which seems like a parser inconsistency.
This issue also affects Cactus
Can confirm.