minecraft.selector.invalid
Severity: error
The target selector used in this command is invalid. Either it uses a fake entity (@fake) in a context where only real entities or players are allowed, or a player-only selector is used in a context restricted to players.
This error is triggered by the language server when a target selector fails validation. Common causes include:
- Using a fake entity selector (
@e[type=<fake_entity>]) in a command that only accepts real Minecraft entities - Using
@a(all players) or@p(nearest player) in a command context restricted to players, when a non-player entity might be matched - Using an entity selector in a command that explicitly requires a player
Using a fake entity where a player-only selector is required:
# Invalid — xp command requires a player, not a fake entity
xp 10L @e[type=example:fake_npc]
# Correct — use a player selector
xp 10L @a
xp 10L @p- Use a player selector (
@a,@p,@swhen executed as a player) in commands that require players - Use
@e[type=player]to explicitly filter for player entities when needed - If using fake entities, ensure the command context supports fake entity selectors
- Check the specific command's documentation page for what selector types are accepted