You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Client crash when pressing F3 inside a Compact Machine #646
Pressing F3 (debug HUD) while the player is inside a Compact Machine room crashes the client.
The crash happens in the Compact Machines debug overlay path: RoomMetadataDebugOverlay.render(...) calls CompactMachines.room(...), which dereferences a null ROOM_REGISTRAR and throws a NullPointerException.
This is reproducible with CompactMachines 7.0.68 on Minecraft 1.21.1 with NeoForge 21.1.212. The crash occurs before any third-party HUD mods can handle it; removing client performance mods (e.g. ImmediatelyFast/Iris/Sodium) does not change the stack origin.
Mod Version
7.0.68
Forge Version
21.1.212
Link to Crash Log
No response
Screenshot (if available)
No response
How to reproduce
Start a 1.21.1 instance with NeoForge 21.1.212 and CompactMachines 7.0.68.
Enter any Compact Machine room (e.g., via Personal Shrinking Device).
Root cause: CompactMachines.room(String) dereferences the static ROOM_REGISTRAR without a null check. On the client, during debug overlay rendering, ROOM_REGISTRAR has not been populated (it's set via reloadServices(MinecraftServer) on the server side). The call chain from RoomMetadataDebugOverlay.render(...) -> CompactMachines::room therefore NPEs.
Minimal, safe fix (backwards-compatible):
diff --git a/core-api/src/main/java/dev/compactmods/machines/api/CompactMachines.java b/core-api/src/main/java/dev/compactmods/machines/api/CompactMachines.java
index XXXXX..YYYYY 100644
--- a/core-api/src/main/java/dev/compactmods/machines/api/CompactMachines.java+++ b/core-api/src/main/java/dev/compactmods/machines/api/CompactMachines.java@@ -130,9 +130,14 @@ public final class CompactMachines {
@ApiStatus.Internal
private static IRoomRegistrar ROOM_REGISTRAR;
public static Optional<RoomInstance> room(String roomCode) {
- return ROOM_REGISTRAR.get(roomCode);+ // Guard against client-side calls before server registrar is available.+ final IRoomRegistrar reg = ROOM_REGISTRAR;+ if (reg == null || roomCode == null) {+ return Optional.empty();+ }+ return reg.get(roomCode);
}
}
Why this is sufficient:
RoomMetadataDebugOverlay.render(...) already uses Optional.flatMap(CompactMachines::room); returning Optional.empty() when the registrar is unavailable cleanly short-circuits overlay rendering without crashing.
No server behavior changes; once reloadServices(MinecraftServer) initializes ROOM_REGISTRAR, CompactMachines.room(...) works as before.
Activity
twothe commentedon Dec 9, 2025
ChatGPT Analysis
Root cause:
CompactMachines.room(String)dereferences the staticROOM_REGISTRARwithout a null check. On the client, during debug overlay rendering,ROOM_REGISTRARhas not been populated (it's set viareloadServices(MinecraftServer)on the server side). The call chain fromRoomMetadataDebugOverlay.render(...)->CompactMachines::roomtherefore NPEs.Minimal, safe fix (backwards-compatible):
Why this is sufficient:
RoomMetadataDebugOverlay.render(...)already usesOptional.flatMap(CompactMachines::room); returningOptional.empty()when the registrar is unavailable cleanly short-circuits overlay rendering without crashing.reloadServices(MinecraftServer)initializesROOM_REGISTRAR,CompactMachines.room(...)works as before.Gaz492 commentedon Dec 12, 2025
Just going to forward a report we had over on the FTB Issue tracker for this as well.
You can find a crashlog at https://pste.me/@OUsPxuxTedU
FTBTeam/FTB-Modpack-Issues#11015
Mimexe commentedon Dec 12, 2025
duplicate of #638 ?
robotgryphon commentedon Dec 21, 2025
This is caused by the same issue as #638 - registration methods being hit before services are loading. Merging into that ticket...