Skip to content
Back to skills

Detecting Port Conflicts

ASecurity

Detect EADDRINUSE and port conflicts, find what's using the port, and resolve it by killing the process or suggesting an alternative port.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 10, 2026
developmentpythongobashnextjsnodeexpressdjangodocker

Works with

  • terminal

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add 0xAidan/polymarket-bot-test --skill detecting-port-conflicts --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Detecting Port Conflicts?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Detecting Port Conflicts
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/0xaidan-detecting-port-conflicts/badge)](https://www.skillsdirectory.com/skills/0xaidan-detecting-port-conflicts)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: detecting-port-conflicts
description: Detect EADDRINUSE and port conflicts, find what's using the port, and resolve it by killing the process or suggesting an alternative port.
user-invocable: true
---

# Detecting Port Conflicts

When a dev server fails to start because a port is already in use, diagnose and resolve it.

## Detection

Scan terminal output for these patterns:
- `EADDRINUSE`
- `address already in use`
- `Port XXXX is already in use`
- `bind: address already in use`
- `OSError: [Errno 98] Address already in use`

Extract the port number from the error message.

## Diagnosis

Find what's using the port:

```bash
lsof -i :<PORT> -P -n
```

This shows the PID, process name, and user. Common culprits:
- A previous dev server that didn't shut down cleanly
- Another project's dev server
- A Docker container
- A system service

## Resolution Options

### Option 1: Kill the blocking process

```bash
kill <PID>
# If it doesn't stop:
kill -9 <PID>
```

Then restart the original server.

### Option 2: Use a different port

Suggest the next available port:

```bash
# Check if port+1 is free
lsof -i :<PORT+1> -P -n
```

Update the dev server config or start command:
- Next.js: `next dev -p <PORT>`
- Vite: `vite --port <PORT>`
- Express: set `PORT` env var
- Django: `python manage.py runserver <PORT>`

### Option 3: Kill all node processes (nuclear option)

```bash
killall node
```

Only suggest this if the user confirms — it kills everything.

## Tips

- On macOS, ports below 1024 require root
- Docker containers bind ports that persist even if the container is stopped — check `docker ps`
- If `lsof` shows nothing, the port may be in TIME_WAIT state — just wait 30 seconds or use a different port

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…