Note to moderators: This bug report is NOT a duplicate from MC-30955. Mojang don't want correct the tellraw lenght limit: ok no problem, but this bug report is about random error message with book ! It's not "work as intented" that book generate the error "invalid json" when json is valid. If Mojang want limit the command size, it should display an error message like "command lenght is too long", or better: forbid the creation of corrupted book, or may be remove this nonsense limitation for book (I don't speak about tellraw here). A proof that "Work as intented" about the tellraw bug is not related to the book bug is this other bug: MC-70317. The tellraw command is a chat command, with chat limitation: ok. The book is not chat related, that's why the suggest_command don't work (MC-70317), and that's why the limitation for book (and random error message and corrupted book) are not Work As Intented. It should be Mojang to decide if it's intented or not and what is the solution because it's not the same bug. Thanks for your attention.
There are an error in the book with the run_command tag when text command is more than 100 chars length:
1/ If the text in run_command is too long, it is troncated:
Exemple with this book:
/give @p written_book 1 0 {pages:["{\"text\":\"Hello World\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/say Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft\"} }"],title:"",author:""
}
The give command is valid, but when I click in the book, the text is truncated
(see screenshot 1)
The command outside the book work with no problem:
/say Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft
2/ If I use a formatted text, there are an error. I try with the same example as 1/, but with yellow color displayed with a tellraw command:
/give @p written_book 1 0 {pages:["{\"text\":\"Hello World\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tellraw @a {\\\"text\\\":\\\"Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft\\\",\\\"color\\\":\\\"yellow\\\"}\"} }"],title:"",author:""
}
When I click on the link, the following error occured:
Invalid json: Unterminated string at line 1 column 89
(see screenshot 2)
The command outside the book work with no problem:
/tellraw @a {"text":"Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft Minecraft","color":"yellow"
}
(see screenshot 3)
3/ The real problem with this bug is for tools book, it's impossible to make a custom tools book with complex command. For exemple, this book can spawn a zombie with a Full P4 diamond armor:
/give @p written_book 1 0 {pages:["{\"text\":\"Super Zombie\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/summon Zombie ~ ~1 ~ {ArmorItems:[{tag:{ench:[{id:0,lvl:4}]},id:\\\"minecraft:diamond_boots\\\"},{tag:{ench:[{id:0,lvl:4}]},id:\\\"minecraft:diamond_leggings\\\"},{tag:{ench:[{id:0,lvl:4}]},id:\\\"minecraft:diamond_chestplate\\\"},{id:\\\"minecraft:diamond_helmet\\\",tag:{ench:[{id:0,lvl:4}]} }]}\"} }"],title:"",author:""
}
When I click on the link, the following error occured:
Data tag parsing failed: Unbalanced brackets: {ArmorItems:.....{tag:{en
(see screenshot 4)
The command outside the book work with no problem:
/summon Zombie ~ ~1 ~ {ArmorItems:[{tag:{ench:[{id:0,lvl:4}]},id:"minecraft:diamond_boots"},{tag:{ench:[{id:0,lvl:4}]},id:"minecraft:diamond_leggings"},{tag:{ench:[{id:0,lvl:4}]},id:"minecraft:diamond_chestplate"},{id:"minecraft:diamond_helmet",tag:{ench:[{id:0,lvl:4}]} }]
}
(see screenshot 5)
The displayed error is always different, for a unique bug.
I report this bug because many users of my book generator report to me this problem, but I can't help them, it's a bug with Minecraft.
Linked issues
is duplicated by 2
relates to 2
Attachments
Comments 29
MC-30955 is about run_command, not specifically about /tellraw. Use /trigger.
@redstonehelper The bug is not that we can't do it. The bug is that MC is giving a weird error message that should be more clear.
that is not a bug in this case, as the command gets trimmed as it doesn't fit within the boundries, a diffrent error message is a feature request, which belong here
@FVbico It's not a feature request because the error is due to Minecraft. Minecraft say "invalid json", but json is valid... so it's a bug if the message error is not correct. This bug report explain how (internaly) Minecraft cause this bug and how it is possible to reproduce it (to help developper to solve it), but the bug is that Minecraft corrupt the books, and display random error messages.
So this bug report should be reopen
Regarding the back and forth between the Mods and Tronics in the earlier comments, I understand the issue.
It has to do with the way that Players and Developers see the game. Developers are used to things performing in certain ways and locations; Players, however, are not. When it comes to the way that commands work when executed from clicking a sign or text in a book, a Developer will know that the command is being executed through the chat by the player that activated it. The Player, on the other hand, will not. Unless the Player themself is versed in code and has a background in that area (which will allow them to understand the inner workings of the game), they will assume it has it's own mechanism to run commands as Players naturally deem that any command run by them must be first typed out into chat before being executed, otherwise it would be run in the background (like commands run from a function file, for example). Because of that, when the Player puts a command under run_command that is too long (but is formatted correctly), the game will spit out the typical Invalid JSON errors, even though the command is correct, leading to the Player getting confused as to why it won't work. Ultimately, the Player will have to find out on their own (likely through Internet searching) about the limit and why it exists, further adding to the confusion and frustration.
What Tronics was trying to propose was to alter the way that the game alerts players to the issue of a command being too long under run_command as simply telling the Player that the command is invalid leads to confusion as they're unlikely to know how the run_command works in the first place. By having alerts that inform the Player about the limit, it would help to alleviate any potential confusion.
My Opinion: This can go both ways in terms of being a Bug or a Feature Request. While it does have the feel of a Feature Request, it can also be seen as a bug as typically a game's developers would choose to design the game in a way that everyone can use it with the only real confusion being when the players are new and must learn the controls and (user-side, not behind-the-scenes) mechanics. I, personally, would go with a chat message alerting the player to the command being too long. (I know the proper place to suggest it.)
Just tested this with 1.20-rc1, this is appearing to be resolved as fixed. I used a MASSIVE command that is not 1000+ characters, not 10000+, but 20 thousand characters long. And it ran perfectly like if it were from a command block.
This does need to be fixed, as a map maker it is very annoying