# The server could not open its network port

A Minecraft server, proxy or plugin tried to listen on a port another process already holds, so players cannot connect through it.

- Code: `port_bind_failed`
- Severity: error
- Category: Network
- Server types: Every server type, Velocity, BungeeCord, Waterfall
- Page: https://failures.perland.online/failures/port_bind_failed/

## Example log

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

## Parameters

| Parameter | Meaning |
| --- | --- |
| `port` | The port that could not be opened, when the log names it (the server's own port, such as 25565). |

## Log lines this page covers

- `**** FAILED TO BIND TO PORT!`
- `Perhaps a server is already running on that port?`
- `java.net.BindException: Address already in use`
- `bind(..) failed: Address already in use`
- `Can't bind to`
- `Could not bind to host`

## What it means

A program can only listen on a network port that no other program holds. When the server starts, it asks the operating system for its port (25565 by default for Minecraft, 25577 for Velocity). If the port is taken, the request is refused and the server prints a bind failure.

When the failing port is the server's own, the server cannot accept players and the run is over: vanilla, Paper and the mod loaders stop. A proxy (Velocity, BungeeCord, Waterfall) keeps running with nothing listening, which looks like a server that is up but unreachable. When the port belongs to a plugin's own web server (a web map such as Dynmap, a stats page), the game server goes on and only that plugin's page is missing, so the issue is an error, not fatal.

## Why it happens

- **A copy of the same server is still running.** The previous run has not finished stopping, or a second container or process was started with the same port.
- **Another program uses the port.** A different game server, a proxy, or any service on the same host listens there.
- **Two plugins, or a plugin and the server, share a port.** A web map, a voice chat plugin or a query plugin was configured with the server's port or with another plugin's port.
- **The port is set to one the server may not use.** On Linux, ports below 1024 need extra privileges.

## How to fix

1. Stop the server and wait until it has fully stopped (the last lines of its log say the world was saved), then start it again.
2. If it happens again, find what holds the port. On Linux, `ss -ltnp | grep 25565` lists the process listening on 25565; on Windows, `netstat -ano | findstr 25565` gives its process ID.
3. If the bind failure names a plugin's port rather than the server's (the line comes from the plugin, such as `Failed to start WebServer on address 0.0.0.0:8123`), open that plugin's configuration and give it a free port.
4. **Proxies:** check `bind` in Velocity's `velocity.toml` or `host` under `listeners` in BungeeCord's and Waterfall's `config.yml`.
5. **Docker:** two containers cannot publish the same host port. Check the `ports:` of every service with `docker ps`.

## In Perland

Perland assigns every server and proxy its own port and shows this issue in the server's Diagnosis tab with the port it names. Stopping the server and starting it again from the panel clears a leftover run. If a plugin's web server fails to bind, change its port in the plugin's configuration in the Files tab or in Plugin Studio.

## References

- [Minecraft Wiki: server.properties (`server-port`)](https://minecraft.wiki/w/Server.properties#server-port)
- [Velocity configuration reference](https://docs.papermc.io/velocity/configuration)
