The server ran out of metaspace, not heap
What it looks like in your log
java.lang.OutOfMemoryError: Metaspace
What causes it
Class metadata space filled up, which happens with very large modpacks or a -XX:MaxMetaspaceSize cap set too low.
How to fix it
Remove any MaxMetaspaceSize flag from the start command, or raise it. More -Xmx does not help this one.
Why it happens
Metaspace is where Java keeps class definitions: every mod, every plugin, every generated class from a mixin or a scripting library. It is separate from the heap, so -Xmx has no effect on it. Very large modpacks load tens of thousands of classes, and if the start command sets -XX:MaxMetaspaceSize to a value copied from an old tutorial, the pack runs out of room while still booting.
Older Java tutorials told people to set MaxMetaspaceSize=256m or 512m. That was advice for Java 8 plugin servers. A 300-mod NeoForge pack can want over a gigabyte.
Fix it step by step
- 1Find the flagLook in the start command or JVM arguments for -XX:MaxMetaspaceSize. If it is there, that is the cause.
- 2Remove it, or raise it well past the packRemoving the cap lets metaspace grow as needed, which is the right default for a modded server with memory headroom. If you must cap it, 1G is a sane floor for a large pack.
- 3Check the totalMetaspace lives outside -Xmx, so account for it when sizing the heap against the machine or container limit. A pack that needs 1 GB of metaspace on a 12 GB plan cannot also have a 10 GB heap.
- 4Restart and confirmThe server should now pass the point in the boot where it died. If it dies later with the same error, a mod is generating classes without limit, and the log just before the error names it.
If that didn't work
If there is no MaxMetaspaceSize flag and metaspace still fills, the process is being limited from outside, by a container or a hosting panel that sets the flag for you. The panel JVM settings are the place to look.
Not sure this is your problem? Paste your log and Roastd will tell you which of these it actually matched, and what else it found.
Check your own log