The type
parameter grabs a list of string IDs from the same tab-complete list that /summon
uses. If the input into the type
parameter is not among that list, the selector will throw that error. The type
parameter specifically appends "Player" to that list, which is why "Player" does not show up in /summon
's tab-complete.
Among that list is "LightningBolt", which is not actually a valid savegame entity ID. Valid IDs are those that appear within the EntityList
class mapping, which is what the tab-complete function will grab from before forcibly appending the list with "LightningBolt". It is essentially only appended for usability with /summon
, which handles "LightningBolt" directly rather than through an automated process for any other input.
As such, you can safely use type=!LightningBolt
. Lightning bolts themselves are not target-able in the first place. They are not added to the internal list of spawned entities, which is what entity selectors obtain targets from. Even if they were added to that list but remained non-savegame entities, "LightningBolt" is still not associated with them and the selector would target them regardless.
To reiterate: lightning bolts are not excluded by the selector because they are not included in the list of possible targets to begin with, nor is the ID "LightningBolt" associated with them in any way other than as a means of creation via /summon
. It is simply impossible to target lightning bolts.
But since the type
parameter believes that "LightningBolt" is a valid ID due to the /summon
tab-complete list, it can be used without throwing an error. The following will target a random entity from all entities possible with selectors:
/say @r[type=!LightningBolt]
It will also target non-savegame entities such as fishing bobbers. While fishing bobbers do not have an ID at all, they do not have the "LightningBolt" ID which satisfies the selector. Fishing bobbers, unlike lightning bolts, are added to the list of spawned entities, which is why they can be targeted by selectors while lightning bolts cannot be.