How can I test for mob who has a name with two words? For example villager named Grumpy Bill. For example I want to kill this villager.

This command

/kill @e[name=Bill]

would work just fine but when I try

/kill @e[name=Grumpy Bill]

it says "The entity UUID provided is in an invalid format"

What is the proper command for this action?

  • 4
    Have you tried /kill @e[name="Grumpy Bill"]? Commented Feb 9, 2015 at 17:06
  • 1
    @BobR.Shake That doesn't work.
    – SirBenet
    Commented Feb 9, 2015 at 17:22
  • This is out of curiosity (I've never used Minecraft commands) - a lot of command structures use backslash \ To 'escape' the special meaning of symbols and use the literal meaning. In this case, whitespace represents the end of one 'object' or command and the start of another. If we escape the space to use the literal space character, would it work? I.e. /kill @e[name=Grumpy\ Bill]
    – Robotnik
    Commented Feb 10, 2015 at 7:29

4 Answers 4


In 1.13 and above you can add quotes to the name in the selector, like so:

/kill @e[name="Grumpy Bill"]

In 1.12 and below a selector cannot test for a name with spaces or most symbols; it is marked on the bug tracker as "Won't Fix" (but is fixed in 1.13+).

You can however select them by NBT data with their "CustomName" tag. Like this:

/testfor @e {CustomName:"Grumpy Bill"}

If you want to do something other than test for them existing, you'll need to create a dummy scoreboard objective, objectiveName, and then run something like this:

/scoreboard players set @e objectiveName 1 {CustomName:"Grumpy Bill"}

And then:

/kill @e[score_objectiveName_min=1]

Use the NBT Tag "CustomName", and to make it for /kill use: /scoreboard objectives add KillSpacedName dummy KillSpacedName /scoreboard players set @e KillSpacedName 1 {CustomName:Grumpy Bill} /kill @e[score_KillSpacedName_min=1]

  • 1
    This is identical to the accepted answer and adds nothing beyond what was there already. Contrary to the existing answers, it's not formatted, and doesn't describe what it does.
    – MrLemon
    Commented Aug 23, 2015 at 14:29
  • 1
    Exactly what @MrLemon said. Duplicate answers are frowned upon here and may be subject to deletion.
    – user114997
    Commented Aug 23, 2015 at 14:48
  • 1
    Sorry, I'm new to this site. Delete it. Commented Aug 23, 2015 at 14:49
  • 1
    @TheGamerGhast hope we didn't alienate you. This site is quite a bit stricter than your typical forum (which this isn't!). Check out the help center and the tour for new users.
    – MrLemon
    Commented Aug 23, 2015 at 15:16

I've learned that you cannot have a space between the words of the name, such as Do not touch.

Instead you will need to fill those spaces with underscores. For example, Do_not_touch.


In commands, you can't have spaces. Use the underscore. Something like


  • 3
    This is the same answer already left by someone else. New answers should contribute new or helpful information Commented Aug 5, 2015 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .