mojira.dev
MC-5520

Crash when toggling fullscreen mode: Keyboard must be created before you can read events

The bug

Minecraft crashes when you toggle fullscreen mode.

https://bugs.mojang.com/secure/attachment/131824/crash-2017-01-03_19.35.37-client.txt (MC-112232) (1.11.2)

Description: Updating screen events

java.lang.IllegalStateException: Keyboard must be created before you can read events
	at org.lwjgl.input.Keyboard.next(Keyboard.java:475)
	at bho.p(SourceFile:386)
	at bes.t(SourceFile:1586)
	at bes.av(SourceFile:970)
	at bes.a(SourceFile:398)
	at net.minecraft.client.main.Main.main(SourceFile:124)

Possible causes

This list contains some of the possible causes for this bug. It is not recommended to skip GPU driver updates or similar since it is not guaranteed that this is really causing this bug.

Workaround

This comment, this comment and MC-113713 suggest setting the refresh rate to exactly 60 hz fixes this problem.

Maybe: Comments in this reddit post suggest that resizing the window while the main menu is open before enabling fullscreen mode prevents this issue from happening.

Linked issues

MC-10566 Crashing when going into Fullscreen Resolved MC-13306 Crash when changing to fullscreen Resolved MC-17056 Full Screen Crash Resolved MC-17357 Crash when switching to fullscreen while joining SMP after switching monitor Resolved MC-17737 Fullscreen Crash Resolved

Attachments

Comments 34

I could not find any existing issue that contains any of the crashes mentioned here. However, all of the crash reports that you have provided are from a modded version of Minecraft. Please try to reproduce the crash in a vanilla (non-modded) version of Minecraft and attach that report or this may be dismissed as being caused by a mod.

Reproduced with 1.4.7 (unmodded).

Note:

java.lang.IllegalStateException: Keyboard must be created before you can read events
	at org.lwjgl.input.Keyboard.next(Keyboard.java:467)
	at aul.m(SourceFile:114)
	at net.minecraft.client.Minecraft.l(SourceFile:1086)
	at net.minecraft.client.Minecraft.J(SourceFile:582)
	at net.minecraft.client.Minecraft.run(SourceFile:534)
	at java.lang.Thread.run(Thread.java:680)

Happens when coming out of fullscreen as well.

Just tested it, and it's still an issue in 1.5.

24 more comments

I have been unable to enter full screen mode as well - but I am on a single display so I am not sure if MC-5520 applies.

I filled out my own bug report https://bugs.mojang.com/browse/MC-5520 but it was automatically tagged as a duplicate to MC-297 "Pixel Format not Accelerated" (which it is NOT a duplicate of)...

I downloaded Display Driver Uninstaller from Guru3D website and completely blew away my nVidia drivers in Safe Mode. I then installed the drivers from nVidia's website. I am STILL getting the same issue.

Again - not sure if it is the same bug as MC-5520 or not - but it does sound like the same errors.

Made some progress. I am on a 4K monitor. I was getting the error while at 1920x1080. If I change my resolution to the recommended resolution of 3840 x 2160 - the game works fine and I can switch between full screen and back without issues. I tried 2560 x 1440 and got the same issue... so it seems to be the same resolution.

UPDATE - seems to be related specifically to the hertz of the resolution. 3840 x 2160 is at 30hz .. the other resolutions are at 59hz .. (Standard PnP Monitor Driver). If I force the hertz to 60hz (thereby resetting resolution to 640x480) it works fine..

*FIXED!*
Finally! In windows, I went into Display Settings, then Advanced display settings, then Display adapter properties at the bottom (under Related settings). I then clicked on the List All Modes button. From there I was able to list all resolutions:

1920 by 1080, True Color (32 bit), 50 Hertz
1920 by 1080, True Color (32 bit), 59 Hertz
1920 by 1080, True Color (32 bit), 60 Hertz

By default it always went to 59 hertz - but I double clicked on the 60 Hertz line, then clicked Apply in the adapter properties window - tried it and it worked. Yay.

Running Win 10 x64 with ATI R9 380 and was getting the same issue. Changed from VGA cable to HDMI and went from 60Hz to 50Hz on my monitor and now I can fullscreen.

Happy to give more info it it helps. Can repeat the steps and in Vanilla MC 1.12.

I got a similar error (not exact but same problem, could not fullscreen) after my nVidia Driver updated for my 550ti. I was finally able to fix it by going into the nVidia settings and changing Scaling to Full-Screen instead of Aspect Ratio under "Adjust Desktop Size and Resolution". The Hertz was already at 60 by default. This was a temporary fix, however, as the game soon crashed with an "Out of Memory" error.

I actually got several intermittent errors before fullscreen stopped completely. The sound would not play at all about 50% of the time. I reinstalled Minecraft as a result, which for some reason changed the default JVM arguments to "-Xmx1G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=16M" instead of the previous -"Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M". So, after I had fixed the video settings, I had to change my JVM arguments back (Actually bumped it a little to "-Xmx3G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn256M" after I confirmed it fixed the "Out of Memory issue"). Running with absolutely no issues now. I will note: I installed Minecraft with the onboard graphics the first time; installed the 550ti at a later time, so Minecraft may be applying the wrong arguments based on my system configuration.

I should note that I will now have to fix the JVM arguments with each there is a Minecraft update, as the JVM arguments still default to the previously defunct arguments with each new version I install. It even applied the arguments to Optifine when I attempted to install. Had I not kept a backup of the arguments for reference, I would have been completely at a loss.

Crash logs for reference.

[media][media]

I just realized that this bug is marked as fixed for a much older version, mine is 1.12. I'll post a new post.

James Clarke

Fry

Community Consensus

client, crash, fullscreen, fullscreen-mode, lwjgl, monitor

Minecraft 1.4.6, Minecraft 1.4.7, Snapshot 13w09a, Snapshot 13w09b, Minecraft 1.5, ..., Minecraft 1.9.1 Pre-Release 2, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.10.2, Minecraft 1.11.2, Minecraft 1.12

Minecraft 13w36a, Minecraft 17w43a

Retrieved