ForgeNeoForgeFabricQuiltMC 1.12.xMC 1.16.xMC 1.18.xMC 1.19.x

java.lang.StackOverflowError

StackOverflowError means a Java method called itself (directly or through a chain) too many times — usually thousands of frames deep — and the thread's stack memory ran out. In Minecraft this is almost always a mod bug: a getter that calls another getter that calls the original, an event handler that triggers itself, a mixin that hooks the same method it modifies.

Fastest path: paste your crash report into the Crash Doctor — it identifies this pattern and 40+ others automatically. No signup.

How to fix it

  1. 1

    Read the repeated stack pattern in the trace

    Look at the bottom of the StackOverflowError trace. It usually shows the SAME 3-5 lines repeating hundreds of times. Those lines name the mod and method that's recursing. The fix lives there.

  2. 2

    Update the offending mod

    Recursion bugs are almost always known + fixed in a later mod version. Open the mod's CurseForge / Modrinth page, grab the newest version for your MC build, and try again. Most StackOverflowErrors disappear with one mod update.

  3. 3

    Disable the mod as a fast unblocker

    If no update is available, move the mod's .jar out of mods/ and report the bug to the author with the relevant trace lines. Players lose the mod's feature but the server boots.

  4. 4

    Last resort — raise the stack size

    Add -Xss2m (or -Xss4m) to the JVM args. This gives each thread more stack room; it treats the symptom by letting the recursion go deeper before crashing. Use this only if you genuinely can't disable or update the mod — the underlying bug is still there.

Alternative causes

These can produce the same error message — worth ruling out if the steps above don't resolve it.

A mod's event handler triggering itself

Some mods react to a 'block placed' event by placing another block, which fires another event, which… you see where this is going. The trace shows the same event/handler repeating. Disable the mod or change its config (some expose 'react to other mods' toggles).

Mixin inheritance loop

Rare but seen: two mods both mixin the same method with @Inject(at HEAD), and each calls super.method() which routes back through the other. The fix is removing one of the conflicting mods — they can't coexist.

Frequently asked

Is StackOverflowError the same as OutOfMemoryError?

No. OOM is about heap memory (where objects live). StackOverflow is about thread stack memory (where the call chain lives). Different fix, different cause. Same Java family.

Will giving the server more RAM help?

No. Stack size is per-thread, controlled by -Xss, not the heap (-Xmx). More heap doesn't change stack room.

Why does it only happen sometimes?

The recursion needs a trigger — a specific block placed, a specific entity loaded, a specific player action. Until that trigger fires, the recursion never starts. That's why a server can run for hours and then crash on one chunk load.

Want this auto-fixed on your server?

CoalHosting's Minecraft hosting runs the same pattern database against every crash and applies the known fix before your players notice. Free crash diagnosis works on any server, hosted or not.

Related crashes

Last reviewed 2026-06-05. If a step is wrong or out of date, tell us — we'll fix the article and the auto-pattern at the same time.