// crash guide

Minecraft server crash: port already in use

Your server asked the operating system for its network port and was told no, because something else already has it. Usually that something is another Minecraft server, often an old copy of this one that never fully shut down. Your mods and your world are fine.

Updated  ·  Forge, NeoForge, Fabric, Quilt

What the error looks like

The server loads all your mods, then stops before the world loads. Near the end of the console you'll see this (Linux, which is what most hosts run):

[Server thread/INFO]: Starting Minecraft server on *:25565
[Server thread/INFO]: Using epoll channel type
[Server thread/WARN]: **** FAILED TO BIND TO PORT!
[Server thread/WARN]: The exception was: io.netty.channel.unix.Errors$NativeIoException: bind(..) failed: Address already in use
[Server thread/WARN]: Perhaps a server is already running on that port?

On Windows, the second line says Using default channel type instead, and the exception line reads:

[Server thread/WARN]: The exception was: java.net.BindException: Address already in use: bind

Forge and NeoForge also print a logger name on each line, like [Server thread/WARN] [minecraft/DedicatedServer]: **** FAILED TO BIND TO PORT!. Other loaders may format the start of the line a little differently. The message itself is the same on Forge, NeoForge, Fabric and Quilt, because it comes from Minecraft's own server code, not from the mod loader.

Find it in logs/latest.log in the server folder. On newer versions the server may also write a file in crash-reports/ that only says java.lang.IllegalStateException: Failed to initialize server. That report doesn't mention the port, so search latest.log for "FAILED TO BIND".

The words after the exception name tell you which problem you have:

The exception saysWhat it means
Address already in useAnother program is already listening on that port.
Cannot assign requested addressserver-ip in server.properties is an address this machine doesn't have.
Permission deniedOn Linux, the port is below 1024, and those normally need root. On Windows, it can mean Windows has reserved that port for itself. Either way, pick another port.

What it means

Only one program at a time can listen on a given port. When Minecraft starts, it asks for its port (25565 unless you changed server-port). If the operating system refuses, Minecraft gives up and shuts down. The port is opened before the world loads, so your world wasn't touched.

The usual causes, most likely first:

One clue about the old copy: on Minecraft 1.16 and newer, a second copy started from the same folder usually stops earlier, with session.lock: already locked (possibly by other Minecraft instance?), because both copies want the same world. So on those versions, FAILED TO BIND often points to a server in a different folder, such as the old install you kept when you updated the pack. On 1.12.2 and older, the same folder can give this error too.

Common in these packs: none in particular, because Minecraft opens the port itself. Big packs make the most common cause more likely: a server running All the Mods 10 or FTB StoneBlock 4 can take a while to save and exit, and starting it again before the old process is gone gives this error.

How to fix it

  1. Stop it fully, wait, start once. Type stop in the console and wait until the process has really exited. A big modded world can take a while to save. Wait about 30 seconds more, then start the server one time.
    • Pelican panel: click Stop and wait for the status to show offline. If it hangs, use Kill, which skips the save. Then Start.
  2. Find what's holding the port on your own PC or VPS. Use your port if it isn't 25565.
    • Linux: sudo ss -ltnp | grep 25565 or sudo lsof -nP -iTCP:25565 -sTCP:LISTEN. Both show the program and its PID.
    • Windows: netstat -ano | findstr :25565. The last column is the PID. tasklist /FI "PID eq 1234" names it.
    • If it's java, find out which server it is. On Linux, ls -l /proc/1234/cwd shows the folder it was started from, and ps -fp 1234 shows its command line. On Windows, open Task Manager > Details and turn on the "Command line" column.
  3. Stop that program cleanly. If it's an old copy of your server, go back to its console (screen -r, tmux attach) and type stop so it saves. If a systemd service runs it, stop the service with sudo systemctl stop <service>, or it may come straight back. Force-kill only as a last resort: kill 1234, then kill -9 1234 (Windows: taskkill /PID 1234 /F). A forced kill skips the save.
  4. Or give this server another port. If the other program should keep running, set server-port=25566 in server.properties. Each server on a machine needs its own port. Players then join with your.address:25566. If you host at home, forward the new port on your router too.
  5. Clear server-ip. Leave it empty (server-ip=) so the server listens on every address the machine has. 0.0.0.0 does the same, so leave that alone if your panel set it. At home, don't put your public IP there: that address belongs to your router, not your PC. The router forwards the port to your PC, so the server never needs to know it.
  6. Check the start command for --port. A --port argument overrides server-port. Look in your start script, such as run.sh / run.bat on Forge and NeoForge 1.17 and newer. On a Pelican panel, check the Startup tab.
  7. On a hosted panel, match the assigned port. Your server can only use the port the host gave it, which the panel shows with the server's address. server-port must match it. Some panels write it into server.properties on every start. If yours doesn't, change it in the file manager. If it matches and the error comes back after a full stop, contact your host.

This error isn't caused by your Java version, JVM flags or memory settings, so you don't need to change them.

Loader notes

When a mod logs the BindException instead

Some mods open their own port: Simple Voice Chat (UDP 24454 by default, set in config/voicechat/voicechat-server.properties), BlueMap's web map (8100) and Dynmap (8123). If that port is taken, the mod's error usually includes BindException or "Address already in use", so the crash log analyzer may flag it. The game server usually keeps running. Change the mod's port or stop the other program. On a hosted panel, that port must be an extra port assigned to your server.

RCON works the same way. If rcon.port is taken, for example because it's set to the same number as server-port, the log says "Unable to initialise RCON" and the server carries on without it.

How to check it's fixed

Not sure this is your crash?

Paste your log into the free crash log analyzer. It checks your log against known errors, including this one, and tells you what to change.

Related crash guides

Modded hosting is relaunching.

A DSN server gets its port from the panel, and you get a live console, a file manager and SFTP for fixes like this one, plus support from the owner by email. We're moving DSN Servers to new hardware, and ordering is closed until then. Join the launch list and we'll email you when servers open.

Join the launch list