# Two threads used the same part of the world at once and the server stopped

Minecraft's threading check found a world object used from two threads at the same time, usually because of a mod, and stopped the server to protect the world.

- Code: `thread_conflict`
- Severity: fatal
- Category: Mods
- Server types: Every server type
- Page: https://failures.perland.online/failures/thread_conflict/

## Example log

```text
[18:31:07] [Server thread/ERROR] [minecraft/MinecraftServer]: Encountered an unexpected exception
net.minecraft.ReportedException: Accessing PalettedContainer from multiple threads
    at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1748)
    at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1104)
Caused by: java.lang.IllegalStateException: Accessing PalettedContainer from multiple threads
    at net.minecraft.util.ThreadingDetector.makeThreadingException(ThreadingDetector.java:57)
    at net.minecraft.util.ThreadingDetector.checkAndLock(ThreadingDetector.java:38)
    at net.minecraft.world.level.chunk.PalettedContainer.acquire(PalettedContainer.java:105)
```

## Parameters

| Parameter | Meaning |
| --- | --- |
| `object` | The game object two threads used at once, as the error names it (such as LegacyRandomSource or PalettedContainer). |

## Log lines this page covers

- `java.lang.IllegalStateException: Accessing`
- `from multiple threads`

## What it means

Most of a Minecraft world may only be changed by the server's main thread. Since version 1.18 the game guards some of its objects with a threading check: if a second thread uses one while the main thread does, the game throws `IllegalStateException: Accessing <object> from multiple threads` and stops the server. Stopping is deliberate, because two threads writing the same chunk data or random number generator at once can corrupt the world.

The error names the object (a chunk section's `PalettedContainer`, a world's `LegacyRandomSource`), and the game prints the stacks of both threads under `Thread dumps:`.

## Why it happens

- **A mod does world work on its own thread.** Performance mods, world generation mods and mods that scan or change chunks in the background are the usual cause.
- **Two mods that each work fine alone** conflict when one changes how the other's code runs.
- **Less often, a plugin** on a server that runs Bukkit plugins changes the world from an asynchronous task. Paper usually catches that earlier with an error of its own.

The stack trace shows where the main thread was, such as spawning mobs or ticking chunks, not which mod used the other thread. That is why the issue names no mod.

## How to fix

1. Back up the world before you try anything else, since the run stopped while the world was being changed.
2. Update every mod (or plugin) to its latest version for your Minecraft version. Threading bugs are often fixed in later releases.
3. Read the `Thread dumps:` part of the crash report: the second thread's stack often names the mod's package (such as `com.example.mod...`), and on Forge and NeoForge the mixin names at the end of each line (`pl:mixin:APP:<mod>.mixins.json`) point at the mods that change that code.
4. Search the issue trackers of the mods you suspect for the exact message, such as `Accessing LegacyRandomSource from multiple threads`.
5. If nothing names a culprit, remove the mods you added most recently, or half of the optional ones at a time, until the crash stops.

## In Perland

The issue appears in the server's Diagnosis tab with the object it names, and the server's issue history counts how often it came back across runs. On a modpack server, mods are updated and removed in Mod Studio, and a backup can be restored from the server's Backups if the world was damaged.

## References

- [NeoForge documentation: sides and threads](https://docs.neoforged.net/docs/concepts/sides)
