mojira.dev
MC-30450

/give command creates crash-inducing items with incomplete [dataTag]

Steps to Reproduce:

  1. Execute a command such as

    /give @p cake 1 1 {AttributeModifiers:[{AttributeName:"generic.maxHealth"}]}
  2. Observe that the command may declare "An unknown error occurred while attempting to perform this command", but you are still given the item.

  3. Hover over the item, or attempt to scroll the hotbar over it, and observe that the game immediately crashes.

  4. Try re-loading the world. If the bugged item is still in your held slot, you will immediately crash again: the world is now unplayable unless you use a third-party tool to repair it.

What I expected to happen was:
If the command realized that there was an error, why did it still give me a corrupt item? I would have expected to not be given anything, if the tag is incorrectly formatted.

To be honest, this happened on accident; I certainly didn't expect my save to be corrupted.

Note: This is NOT a duplicate of any bug with a similar crash report, unless that bug follows steps similar to the above. I'm aware that similar crashes exist because the crash occurs when attempting to look at a corrupt item. However, this bug report is that /give is able to create corrupt items, not that corrupt items cause crashes.

Linked issues

Attachments

Comments 15

Confirmed, now my test world with all cool stuff is corrupted 😃

If you want to un-corrupt it, you have a few options:

  • If the item's in your inventory, simply delete your player.dat file (e.g. "crazyman.dat" in the "players" folder). However, you'll lose your inventory, XP, spawn location, location, etc.

  • To avoid losing all that stuff, you can use an NBT editor to find the corrupt item in your player.dat's inventory and delete it.

  • If the item's dropped in the world, corrupting entire chunks, you'll need an NBT editor or MCedit to remove the entity without deleting those chunks.

Still, a pretty big inconvenience when this happens accidentally to somebody.

on my test world, it's like you but when i re-open the map, the item is in my hand and it is functionnal.

I don't think that any of the bugs in the duplicate section are duplicates of this bug.
MC-30806 and MC-30850 aren't for sure. You just need to take a brief look at the crash reports.

For MC-30818, MC-30832 and MC-30851 I can't tell for sure because they were posted without reports. But it looks like they have nothing to do with incomplete dataTags either.

Please read the bug report to see if it's actually a duplicate. Currently over 7% of tickets are wrongly being resolved as duplicate. ;-P

Since apparently all crashes and exceptions even remotely related to /give are being lumped into this report (honestly, I hate when that happens - if the cause of the crash is different in the code, it's not the same bug), I'll just throw this one out here: "/give 175 1 6" causes an immediate crash because the renderer doesn't know how to display a "tall plant" item with that damage value.

5 more comments

Still an issue in 1.7.5 and 14w08a

I can't confirm that it still occurs in 14w08a, there's no crash. Seems to have been fixed.

I can't confirm in 14w08a. What command did you use, Gary?

For now, I also can't confirm in 14w08a. AttributeModifiers without Name and UUID tags do not display at all; invalid AttributeName also causes no issues (seems resource packs can even trick it into rendering custom attribute text, if translations are provided for the invalid AttributeName). Incomplete enchantments will default to zero for ID (Protection) and level (so yes, Protection 0, as opposed to Protection 1). CustomPotionEffects with unrecognized or missing ID will be ignored; this actually makes it possible to have a colored "No Effects" potion (with default name "Mundane Potion", regardless of its actual color and reaction to brewing).

Although I haven't been successful at devising a command which creates items which create crashes, the following gem still works:

/give @p cake 1 1 {AttributeModifiers:[{},,{},]}

That code doesn't even get as far as producing an item. It just causes the server and launcher to be locked in an infinite loop; the client is left running on its own. In multiplayer, the client realizes and drops its connection to the server; in Singleplayer the game continues but most physics grinds to a halt. No log or evidence is left in the launcher after the world is exited, but exiting allows the launcher to become functional again. No adverse affects upon returning to the world; however, anything which "happened" after using the command was not saved.

I'm pretty sure I've mentioned that particular issue here, but I don't remember where. It seems to apply to any command which accepts NBT, and occurs in response to certain combinations of double-commas and other things. Nevertheless, I wouldn't call it related to this particular ticket, as it's neither a crash (at least, not completely), nor is it caused by the items (it's caused directly by the command). I'm just mentioning it here in case somebody has confused it for this ticket.

After reattempting, I confirm that the issue seems to be fixed.

WolfieMario

(Unassigned)

Unconfirmed

NBT, command, corrupt, corruption, crash, data, dataTag, give, item

Minecraft 13w36b, Minecraft 13w37a, Minecraft 13w37b, Minecraft 1.7, Minecraft 1.7.2, ..., Minecraft 1.7.4, Minecraft 14w02b, Minecraft 14w02c, Minecraft 14w04b, Minecraft 1.7.5

Minecraft 14w08a

Retrieved