# Minecraft Server Java Exit Codes Explained (/docs/minecraft/fix-java-exit-codes)



When your Minecraft server stops, it returns a numeric **exit code** to the panel. That code tells you *how* the JVM died, which usually points straight at the cause. Exit code 137? Out of memory. Exit code 0? Clean shutdown. Knowing the codes saves you from digging through logs blindly.

> **Where to see exit codes:** They appear in the **Console** of the [XGamingServer Panel](https://panel.xgamingserver.com) at the very end of a stopped session, e.g., `Container exited with code 137`.

All Common Exit Codes [#all-common-exit-codes]

| Code    | Meaning                 | Common cause                                      | First fix                                    |
| ------- | ----------------------- | ------------------------------------------------- | -------------------------------------------- |
| **0**   | Clean shutdown          | You stopped the server, or `/stop` was run        | None — not an error                          |
| **1**   | General error           | Plugin/mod crash, config error, EULA not accepted | Read **first** Console error                 |
| **130** | SIGINT (Ctrl+C)         | Manual interrupt                                  | Restart                                      |
| **137** | SIGKILL — Out of memory | RAM ran out, kernel killed the JVM                | [Increase RAM](/docs/minecraft/how-much-ram) |
| **139** | SIGSEGV — Segfault      | Native lib bug, broken JNI mod                    | Update Java, remove native mods              |
| **143** | SIGTERM                 | Panel sent stop signal (timed out)                | Usually normal — investigate if frequent     |
| **-1**  | Unknown                 | JVM died without reporting                        | Check Console + crash reports                |
| **127** | Command not found       | Wrong Java path / missing binary                  | Reinstall server                             |
| **255** | Unrecoverable error     | Various — usually startup failure                 | Read Console                                 |

Exit Code 137 — The Big One [#exit-code-137--the-big-one]

**This is the most common crash code.** It means the OS kernel killed the JVM because it ran out of memory.

Causes [#causes]

1. **Allocated RAM is too low** for your modpack/playercount
2. **Memory leak** in a plugin or mod
3. **Way too high view-distance** loading too many chunks
4. **Massive entity counts** (mob farms, item stacks)
5. **Out-of-control spawners or pathfinding loops**

Fixes (in order) [#fixes-in-order]

1. **Increase RAM** in the **Startup** tab. See [How Much RAM](/docs/minecraft/how-much-ram).
2. **Apply [Aikar's Flags](/docs/minecraft/jvm-flags)** for better GC behavior.
3. **Lower [view-distance and simulation-distance](/docs/minecraft/render-distance)** to 6–8.
4. **Install [Spark](/docs/minecraft/setup-spark)** and run `/spark health` + `/spark heapdump` to find the leak.
5. **Remove heavy mods/plugins** identified by Spark.
6. **Pre-generate chunks** with [Chunky](/docs/minecraft/pregenerate-chunks).

> **Don't just throw RAM at it.** A 4 GB server hitting 137 with 5 players doesn't need 16 GB — it needs to find the leak. More RAM only delays the crash.

Exit Code 1 — General Error [#exit-code-1--general-error]

The server encountered an error during startup or runtime. Exit code 1 is **diagnostic-by-Console** — the actual cause is somewhere in the log.

Workflow [#workflow]

1. Open **Console** in the panel
2. Scroll to the start of the failed startup attempt
3. Find the **first** line with `ERROR`, `Exception`, `FATAL`, or `Failed`
4. Look up that error in [Server Won't Start](/docs/minecraft/fix-server-wont-start)

Common exit-1 triggers [#common-exit-1-triggers]

* EULA not accepted ([fix](/docs/minecraft/agree-to-eula))
* YAML config syntax error ([fix](/docs/minecraft/find-fix-yaml-errors))
* JSON syntax error ([fix](/docs/minecraft/find-fix-json-errors))
* Missing dependency for a plugin
* Wrong Java version ([fix](/docs/minecraft/java-version))
* Corrupted JAR — reinstall

Exit Code 143 — SIGTERM [#exit-code-143--sigterm]

The panel asked the server to stop and waited a few seconds, then forced it. This is usually **normal** when:

* You clicked **Stop** in the panel
* A scheduled restart fired
* The server reached its `max-tick-time` and the watchdog killed it

**It becomes a problem if** you didn't trigger the stop. Frequent unprompted 143s usually mean:

* The server is hitting `max-tick-time` (60 seconds by default) — find the lag source with [Spark](/docs/minecraft/setup-spark)
* A scheduled restart is firing too aggressively
* The watchdog is killing the server during heavy operations like world generation

Exit Code 139 — Segfault [#exit-code-139--segfault]

The JVM hit a segmentation fault — usually from broken native code. Rare but ugly.

Causes [#causes-1]

* **OptiFine, Sodium, or other native rendering mods** on a server that doesn't need them (these are *client* mods!)
* **Outdated JNI libraries** (LWJGL, native compression)
* **Java bug** in an old JVM version
* **Hardware memory error** (rare on hosted servers)

Fixes [#fixes]

1. Remove client-side mods from `mods/` (servers don't need OptiFine, etc.)
2. Update Java in **Startup** to a newer LTS version
3. Open a support ticket with the `hs_err_pidXXXX.log` file (the JVM crash dump)

Exit Code 0 — Clean Shutdown [#exit-code-0--clean-shutdown]

Exit code 0 is **success**. The server stopped cleanly, no errors, no data loss. You see this when:

* You clicked Stop in the panel
* Someone ran `/stop` in chat
* A scheduled restart completed normally

If you see exit 0 but **didn't** stop the server, check if a scheduled task or another admin triggered it.

Reading Exit Codes in Console [#reading-exit-codes-in-console]

Look for one of these patterns at the end of a stopped session:

```
Container exited with code 137
process exited with code 1
[Server Shutdown Thread/INFO]: Stopping server
```

The number is your exit code. The line above usually has the trigger.

Common Mistakes [#common-mistakes]

| Mistake                                     | Fix                                                                     |
| ------------------------------------------- | ----------------------------------------------------------------------- |
| Treating exit 137 as "the server is broken" | It's almost always RAM. Increase it or fix the leak                     |
| Treating exit 143 as a crash                | It's usually a normal stop or scheduled restart                         |
| Looking at the *last* error in Console      | The **first** error is the cause                                        |
| Ignoring exit 0 from unscheduled stops      | Someone ran `/stop` — check op activity                                 |
| Reinstalling on every exit code 1           | Most exit 1 errors are config/plugin issues, not corrupted server files |

Related Guides [#related-guides]

* [Server Won't Start](/docs/minecraft/fix-server-wont-start)
* [How Much RAM](/docs/minecraft/how-much-ram)
* [JVM Flags (Aikar's)](/docs/minecraft/jvm-flags)
* [Spark Profiler](/docs/minecraft/setup-spark)
* [Find / Read Crash Reports](/docs/minecraft/find-read-crash-reports)
* [Common Issues](/docs/minecraft/common-issues)
