PerlandFailure catalogue

A mod made for players' games is installed on the server

Fatalclient_only_mod

A mod that only works in the Minecraft game on a player's computer tried to load the game's client code on a dedicated server, so the server stopped.

What the log shows

Written example3 lines
[10:03:17] [modloading-worker-0/ERROR] [ne.mi.fm.ja.FMLModContainer/LOADING]: Failed to create mod instance. ModID: zoomlens, class dev.example.zoomlens.ZoomLens
java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER
	at TRANSFORMER/[email protected]/dev.example.zoomlens.ZoomLens.<init>(ZoomLens.java:22)

Your log will have other names, versions and times. Search a line of it from all failures.

What it means

The Minecraft game a player runs and the dedicated server are two different programs. Everything that draws the screen, plays sound or reads the keyboard exists only in the game. The loader removes that code from the server, and when a mod reaches for it there, the loader refuses and the server stops.

Mods come in three kinds: mods both sides need, server-only mods, and client-only mods (minimaps, shaders, zoom, menu and HUD mods, performance mods for rendering). A client-only mod has nothing to do on a server, and many crash it.

Why it happens

  • A client-only mod was copied to the server. The whole mods folder of a player’s game was uploaded, or a modpack’s client mods were not left out.
  • The modpack marks a client mod for both sides. The pack’s file says the mod belongs on the server too.
  • A mod forgot to keep its client code apart. A mod meant for both sides calls client code from code that runs on the server; this is a bug of that mod.

How to fix

  1. Read mod: it is the mod to take off the server. If the issue names only the class, the mod is the one whose package or file name appears in the trace.
  2. Remove that mod from the server. Players keep it in their own game; the server does not need it to let them join.
  3. Check the mod’s page (Modrinth shows “Client” or “Server” support) for other mods of the same kind still on the server.
  4. If the mod is meant to run on servers too, update it: a newer version may fix the bug. Otherwise report it to its author with the log.
  5. Modpacks (packwiz): set the mod’s side to client so the server leaves it out and players still get it.

In Perland

The issue appears in the server’s Diagnosis tab with the mod and the class it tried to load. On a server whose mods come from a modpack, the fix button leads to the server’s Sources, and Mod Studio is where you remove the mod or set it to the client side so players still get it. Otherwise, remove the jar from the mods folder in the Files tab.

References

Details the diagnosis reports

Perland's server diagnosis returns this failure as the code client_only_mod with these parameters, each present only when the log names it.

ParameterMeaning
classThe class the mod tried to load that a server does not have (a net/minecraft/client class on Forge and NeoForge, the client-only class on Fabric and Quilt).
modThe mod that tried to load it, when the log names it (Forge's "ModID:" or Fabric's and Quilt's entrypoint "provided by").

Log lines this page covers

  • Attempted to load class net/minecraft/client/<class> for invalid dist DEDICATED_SERVER
  • Cannot load class <class> in environment type SERVER
  • Cannot load <class> because Mismatched @Envrionment