Skip to content

[Bug] NoteScreen crash — setScreen called on wrong thread #137

Description

@VincentZyu233

[Bug] NoteScreen crash — setScreen called on wrong thread

Summary

Game crashes with IllegalStateException when opening the NoteScreen (sneak + right click with Note item). Fabric Screen API detects that setScreen was called off the render thread.

Exception

java.lang.IllegalStateException: [fabric-screen-api-v1] The current screen
  (dev.doctor4t.wathe.client.gui.screen.ingame.NoteScreen) has not been correctly initialised,
  please send this crash log to the mod author.
  This is usually caused by calling setScreen on the wrong thread.

Root Cause

In NoteItemMixin.java#L23-L28:

@Inject(method = "use", at = @At("HEAD"))
private void useClient(World world, PlayerEntity user, Hand hand, ...) {
    if (!user.isSneaking()) return;
    MinecraftClient.getInstance().setScreen(new NoteScreen()); // ← not on render thread
}

Item#use may be called off the render thread, but setScreen must run on the render thread.

Suggested Fix

MinecraftClient.getInstance().execute(() -> {
    MinecraftClient.getInstance().setScreen(new NoteScreen());
});

Steps to Reproduce

  1. Launch modpack The Last Voyage of the Harpy Express (v1.3.2) on MC 1.21.1
  2. Enter a world (integrated server, 6 players online)
  3. Sneak + right click while holding a Note item
  4. Game crashes immediately

Environment

Item Detail
Wathe 1.3.2-1.21.1
Minecraft 1.21.1
Fabric Loader 0.17.2
Fabric API 0.116.7+1.21.1
Java 21.0.7 (Azul OpenJDK)
OS Windows 11

Full Report

📎 Full crash report, game log, and detailed analysis:
https://github.com/VincentZyu233/wathe-notescreen-crash-report-20260212

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions