Updated:

Check these first

Narrow it down

  1. Try a short version of the command first.
  2. Fix the target to @p.
  3. Use coordinates next to you.
  4. Remove NBT or components for now.
  5. When it works, add the parts back one at a time.

Test on a copy of an important world.

By symptom

"Unknown or incomplete command"

A misspelled command name or a missing argument. /give diamond fails because the target is missing. A command your edition does not have, such as /data on Bedrock, gives the same message. See unknown or incomplete command.

Text turns red partway through

Java colors the chat red from the first problem onward. Check the argument just before the red starts.

No error, but nothing happens

The syntax is fine but nothing matched. Loosen type or distance; see No entity was found.

A command block does nothing

Check the block type, Needs Redstone or Always Active, chain arrows, and enable-command-block=true on servers. Full list in command block not working.

Common culprits per command

Permission

In single player, commands need Allow Cheats from world creation. Java can enable them temporarily with Open to LAN; Bedrock has a world setting, but turning it on disables achievements for that world. On servers you need operator status from /op.

Was the command written for another version?

Check when a command you found was written. Java changed command formats heavily in 1.13, in 1.20.5 (item NBT became components; see NBT vs components) and in 1.21.5 (text and item details). The converter can update some of them.

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.