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.

The Console tab with the Search logs box and the All levels filter framed in red above the log, which shows INFO lines and a yellow WARN line
Search the console for invalid dist to jump straight to the line, then read the lines around it for the mod file.
The logs folder in the Files tab with an older log ending in .log.gz, which has an Extract button, and latest.log, which has an Edit button

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.

Read the crash report step by step

Forge and NeoForge write a crash report for this error in crash-reports, named after the date and time, such as crash-2026-11-08_14.22.31-server.txt. Three parts of it point to the mod.

Where in the reportWhat to look for
Description: at the topUsually Mod loading error has occurred or the invalid dist line itself
The first lines of the stack traceClass names under the mod's own package, such as com/author/modname
-- MOD modid -- blocks further downThe mod ID and Mod File: with the name of the jar in /mods

The mod ID in such a block is the short internal name, which can differ from the file name. The jar named next to Mod File: is the one to take off the server.

Top folder of the server in the Files tab with the world folders and the Upload and From link buttons marked

Before you delete a jar, download it or make a backup on the Backups tab. If you took the wrong one, you can put it back in a few seconds.

Mods that have a client and a server part

Some mods ship as one jar that works on both sides, and only crash on a server in one version or with one setting. Others come as two files: a full mod for players and a smaller server part. A few patterns:

  • A map mod with a server part, such as a waypoint or map sharing mod, often has a separate jar or a separate download for servers. Use that one.
  • A mod that crashed after an update may have had a bug that the next release fixes. Look at its changelog before you remove it for good.
  • A library that is only needed by a client mod can go as well, once that client mod is gone.

If a mod you really want on the server keeps crashing with this error, take the full line to the mod's issue tracker. It is a bug in the mod: a mod that runs on servers must not touch client classes there.

Check the server starts cleanly

  1. Start the server from the top of the panel.
  2. Wait for Done in the Console. A large modpack can take a minute or two.
  3. Search the console once more for invalid dist and for ERROR. A second client mod gives the same line with another class.
  4. Join from your own game with the same modpack to see that everything still works.
Overview of a stopped server in the control panel with the Offline label and the Start button marked

Still crashing on something else? Server won't start covers the other errors that stop a modded server during startup.

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.

Where do I find the crash report for invalid dist DEDICATED_SERVER?

In the crash-reports folder on the Files tab. The newest file has the date and time of the crash in its name.

Why did the server crash after I copied my mods folder?

Your own mods folder holds client mods such as shaders and minimaps. Copy only the mods that add content, or install the modpack from the Mods tab.

Does invalid dist DEDICATED_SERVER damage my world?

No. The server stops before the world loads. Remove the client mod and the world starts as it was.

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 .