Minecraft – Failed to execute fill command on player

minecraft-commandsminecraft-java-edition

There are other questions regarding this but they had other problems like wrong commands, so here goes:

I gave a command block the command

execute @a ~0 ~0 ~0 fill ~-30 ~-30 ~-30 ~30 ~30 ~30 minecraft:diamond_block 0 replace minecraft:gold_block

This should replace all gold blocks close to players with diamond blocks (just used them as a quick test that won't affect other things in nature). I was the only person on the server, activated the command block, but it said "Failed to execute […] on player [me]" (It also doesn't replace the gold block conveniently placed next to me).

Is there anything wrong with the command?

Best Answer

For situations like this, I'd recommend running the command being executed itself (the /fill command) to see what the error is.


The main error appears to be that you're trying to fill a quarter of a million blocks, which is more the maximum (32678) that Minecraft allows for. You could reduce your fill region:

/fill ~-15 ~-15 ~-15 ~15 ~15 ~15 minecraft:diamond_block 0 replace minecraft:gold_block

Or, if the huge area is important, split it up into multiple commands:

/fill ~0 ~0 ~0 ~30 ~30 ~30 minecraft:diamond_block 0 replace minecraft:gold_block
/fill ~0 ~0 ~0 ~-30 ~30 ~30 minecraft:diamond_block 0 replace minecraft:gold_block
etc.

(I'd suggest not running either of these on a clock)


That should be it, but keep in mind that the command will also fail if there are no gold blocks to replace, or if you're too low-down/high-up so that the relative coordinate are selecting an area outside of the world.