Which problem?
So you are using ClientCommandHandler for your command?
You say "I just removed the Runnable thing" and then you say "the first time I do a Runnable...". Please clarify. Post updated code, ideally.
99% this is caused by you opening the GUI from a different thread than the client main thread.

Uhm no I started to rename the buttonId starting by 0, 1 and so on and that fixed the problem. And I'm doing all this on client side, I just removed the Runnable thing now while opening the GUI and it works fine. Correct me if I am wrong although the program seems to run fine. When opening the GUI the first time I do Runnable a add a tick to open the GUI so to not crash but later on as I'm jumping from screen to screen it does not do that.
And can you reply a solution to this as well along with your reply to this reply, "When I open the gui i have no rendered cursor, it only shows up when i move my mouse outside of the minecraft window and move it back in. Fix for this. @diesieben07"