Minecraft server help centre

Troubleshooting

Fix "Attempted to load class for invalid dist DEDICATED_SERVER"

Every Minecraft mod is made for the client, the server or both. A client mod changes what one player sees or hears: a minimap, shaders, a zoom key, a nicer menu. When such a mod ends up in a server's mods folder, the server tries to load it, reaches for a part of the game it does not have, and stops.

The error even says which part of the game was missing. This guide shows how to get from that line to the right jar, which kinds of mods to keep off a server, and what to do when a modpack brought them in.

In short

Attempted to load class ... for invalid dist DEDICATED_SERVER means a mod on your server reached for a part of the game that only exists on a player's computer, such as the menus, the mouse or the video settings. A server has no screen, so Forge or NeoForge stop it there. Remove that mod from the server's mods folder; players can keep it in their own game.

The error on Forge and NeoForge

[main/ERROR] [net.minecraftforge.fml.loading.RuntimeDistCleaner/DISTXFORM]: Attempted to load class net/minecraft/client/gui/screens/Screen for invalid dist DEDICATED_SERVER

NeoForge writes the same line with net.neoforged.fml.common.asm.RuntimeDistCleaner at the start. DEDICATED_SERVER is the loader's name for a server without a screen, and invalid dist means the class that was asked for belongs to the other side: the game on a player's computer.

Class in the lineWhat the mod wanted
Anything under net/minecraft/client/gui/Menus, buttons and the HUD
Anything under net/minecraft/client/renderer/Drawing the world: shaders, lighting, models
net/minecraft/client/Options or net/minecraft/client/KeyMappingVideo settings and key bindings
net/minecraft/client/MouseHandlerThe mouse
A class in the mod's own packageA part the mod itself marked as client only, such as its settings screen

Find the mod that caused it

  1. On the Files tab, open the newest file in the crash-reports folder, or scroll up in the Console from the error.
  2. Look for Mod file: followed by a path in /mods. That is the jar to remove.
  3. No path? When the class is in a mod's own package, such as com/author/somemod/..., the package names the mod.
  4. Still unsure? Move half of the mods out of mods and start the server. If it starts, the client mod is in the half you moved; if it crashes again, it is in the half that stayed. Keep halving that half.

Halving a modpack's mods can give missing dependency errors along the way. They only mean a library went out without the mod that needs it, or the other way round. Put it back and carry on; missing mod dependencies explains those lines.

Once you know the jar, remove it with Filter installed mods on the Mods tab, or delete it from mods on the Files tab, and start the server again. A second client mod in the same folder shows up as the same error with another class; repeat until the server starts.

Mods that belong on players' computers only

These kinds of mods are made for the game, not for the server. Players can use them on any server, yours included, without the server having them.

  • Shader and rendering mods, such as OptiFine, Oculus, Iris, Embeddium and Sodium
  • Minimaps and world maps, unless the mod page says it has a server part
  • Zoom, freecam, HUD, menu and key binding mods
  • Sound, animation and particle mods that only change what one player hears or sees

Mods that add blocks, items, mobs, dimensions or recipes are the opposite: they must be on the server and on every player. When you are not sure, the mod's page on Modrinth says whether it is needed on the client, the server or both. The catalog on the Mods tab only lists mods that run on a server.

When a modpack brought the client mods in

A modpack is made for players, so its folder on your computer is full of client mods. Copy that folder to a server and this crash follows. Install the pack on the Mods tab instead: the panel sets it up from the pack's server files, without the mods that are only meant for players. Install a modpack shows the steps.

On Fabric the message is different

Fabric leaves out mods that declare themselves client only, so those never cause trouble there. A client class that still gets loaded stops the server with Cannot load class ... in environment type SERVER. The fix is the same: find the mod and take it off the server.

Questions from Minecraft server owners

What does invalid dist DEDICATED_SERVER mean?

That a mod tried to load a part of the game that only exists on a player's computer. A dedicated server does not have it, so Forge or NeoForge stop the server.

Can I keep a client side mod on the server if I change its settings?

No. The crash comes from the mod's own code reaching for the game client, and no setting changes that. Keep the mod in your own game instead.

Do my players have to remove the mod as well?

No. Only the copy on the server has to go. In a player's own game the mod keeps working, also on your server.

Is OptiFine allowed on a Minecraft server?

Not on the server itself. OptiFine only changes how the game draws, so it belongs in each player's game, where it works on any server.

How do I know whether a mod is client side before I install it?

The mod's page on Modrinth shows whether it is needed on the client, the server or both. The catalog on the Mods tab only offers mods that run on a server.

Checked against Forge 1.20.1 and NeoForge 1.21.1 crash logs from servers on our platform, November 2026. Written by the Cheapest Minecraft Hosting team, first published , updated .