Started by
_Cherry_
on
Topic category: Troubleshooting, bugs, and solutions
Hi, I am running into a fatal crash where when I open one of my custom GUIs, the game ends with an "Index 0 out of bounds for length 0" error.
The GUI is opened from a player right click action, there is no associated block or entity for that gui.
The crash only happens when exported to a fresh copy of neoforge 26.1.2.84, it doesn't happen when you open the GUI within mcreator's minecraft client.
I used this website's search function as well as google to find any solutions, but I haven't been able to find any threads or pages where it got solved. If this is painfully obvious, please forgive me, I just want my game to stop crashing.
Edited by _Cherry_ on Wed, 07/22/2026 - 02:07
You are calling getAmountInGUISlot on a slot ID that does not exist.
If this is not the case, please open a bug report at https://github.com/MCreator/MCreator/issues asap and attach ZIP of your workspace for testing
Also see https://mcreator.net/wiki/minecraft-crashes-when-i-open-my-gui
Hi Klemen, I did see that page in my search but as I am not using a inventory based GUI I didn't think it applied.
The crash happens on these GUIs with one slot, slot zero. I am only referencing slot zero, but it still crashes with that error.
I was trying to submit a but report but there seem to be a mountain of more requirements that I cannot meet for this issue: The issue is not reproducable reliably with in mcreator, usually only occuring after playing in a survival world for a few hours. But my mod and mcreator is always in the crash report. So it is clearly my problem.
I checked a bit and can't find why this would rarely happen. If you find out more about when this happens etc., let us know
I had some development, finally was able to recreate the crash within the mcreator test environment.
Crash log: https://mcpaste.io/2a47f789e1ea8284
My workspace: https://drive.google.com/file/d/1T2Ec3PqGjALNlpz9NpsGVEVRyoWHPlQG/view?usp=sharing
You would just open the only world and sneak-right-click on the custom mob in front of the player to get the crash.
Thanks. I will check it out
The problem is that you use a procedure to open the GUI, the GUI can bind to the block at the location of the procedure trigger.
For users to make it easier, MCreator auto-binds to blocks if they have inventory. The location you trigger the GUI at can contain block in some cases, which in case if the block has inventory of size 0, the game will crash.
I recommend opening the GUI at some other location, e.g. a bit higher in y axis or even at e.g. 0,0,0 location, if other actions allow you that
I will see if this can be improved in future releases
We will do some improvements: https://github.com/MCreator/MCreator/pull/6515