Checked for versions: Java Edition 1.20 to 26.3. Bedrock Edition uses a different /give syntax and is not covered here.
First find out which version you are on
Look at the version in the launcher profile or the top line of the F3 screen; on a server, the multiplayer list shows it next to the server name. Then use this table to see which shape the command needs.
| Version | Item data | Name | CustomModelData |
|---|---|---|---|
| Before 1.20.5 | NBT in {} after the item | display:{Name:'{"text":"…"}'} | CustomModelData:12 |
| 1.20.5 – 1.21.3 | Components in [] | custom_name='{"text":"…"}' | custom_model_data=12 |
| 1.21.4 | Components | custom_name='{"text":"…"}' | custom_model_data={floats:[12f]} |
| 1.21.5 – 26.x | Components | custom_name={text:"…"} | custom_model_data={floats:[12f]} |
The same item in four versions
A paper named Guild Pass with model hook 12. Before 1.20.5:
/give @p minecraft:paper{display:{Name:'{"text":"Guild Pass","italic":false}'},CustomModelData:12} 1
1.20.5 to 1.21.3: item components in square brackets, the name still a JSON string:
/give @p minecraft:paper[minecraft:custom_name='{"text":"Guild Pass","italic":false}',minecraft:custom_model_data=12] 1
1.21.4: CustomModelData became a set of typed lists, so the bare number is rejected:
/give @p minecraft:paper[minecraft:custom_name='{"text":"Guild Pass","italic":false}',minecraft:custom_model_data={floats:[12f]}] 1
1.21.5 to 26.x: text components are written in SNBT, so the name loses its quotes:
/give @p minecraft:paper[minecraft:custom_name={text:"Guild Pass",italic:false},minecraft:custom_model_data={floats:[12f]}] 1
Each line works only in its own range. That is why "the command from the video" so often fails: the video was made for another version.
What the failure tells you
- Red text with
<--[HERE]. Minecraft stopped reading at that point. Everything before the marker was understood, so the problem is the first thing after it: a bracket of the wrong era, a missing comma, or a component name that does not exist in your version. - The item is named
{"text":"Guild Pass"}. You are on 1.21.5 or newer with a 1.21.4-style name. Remove the outer single quotes and the quotes aroundtext. - The command works but the item looks vanilla. The command is fine; the resource pack is not. From 1.21.4 the model is chosen by a file in
assets/<namespace>/items/, and oldoverridesinmodels/itemare ignored. - Unknown enchantment or attribute. IDs changed too:
sweepingbecamesweeping_edgein 1.20.5, attributes lost thegeneric.prefix in 1.21.2, and the curse of vanishing isvanishing_curse. - Works in chat, does nothing in a command block. Command blocks must be enabled on the server (
enable-command-block=trueinserver.properties), and in a command block@pmeans the player nearest to the block.
Too long for chat
Chat accepts 256 characters per command; a command block holds up to 32,500. A /give with a name, lore, enchantments and attributes passes 256 quickly. Get a command block with /give @p minecraft:command_block, paste the command there and power it with a button.
A debug order that finds the broken part fast
- Check the version and pick the matching row of the table above.
- Run the bare item first:
/give @p minecraft:paper. If that fails, the problem is the selector or permissions, not the item data. - Add one component at a time, name first, then lore, then the model hook, then enchantments. The step that breaks is the one to fix.
- When the command works but the look is wrong, move to the resource pack and check that the model hook in the pack reads the same slot the command fills.
If you write these often, the custom item builder produces the command for each of the four versions from the same fields, which removes the quoting step where most mistakes happen.
FAQ
Why does my old world still have the items, but my commands stopped working?
When a world is opened in a newer version, the game converts the items stored in it. Text inside command blocks, functions and your notes is not converted, so those commands keep the old syntax until you rewrite them.
custom_name or item_name?
Both exist since 1.20.5. custom_name behaves like an anvil rename: italic unless you set italic:false. item_name is the item's own name: not italic, and an anvil cannot remove it.
Can I keep one command for several versions?
Not across the 1.20.5, 1.21.4 and 1.21.5 boundaries. Keep one line per version range, or keep the item data in one place and generate the commands.