Skip to main content
This covers port conflict issues and how to resolve them.

Development Server Port Conflict

Symptoms

pnpm dev

Error: listen EADDRINUSE: address already in use :::10280

Cause

Another process is already running on the specified port.

Solutions

1. Find and Kill Process

macOS/Linux:
# Find process using the port
lsof -i :10280

# Kill process
kill -9 <PID>
Windows:
# Find process using the port
netstat -ano | findstr :10280

# Kill process
taskkill /PID <ProcessID> /F

2. Manually Specify Port

sonamu.config.ts:
export default {
  server: {
    listen: {
      port: 10281,  // Use different port
      host: "localhost"
    }
  }
} satisfies SonamuConfig;

Sonamu UI Access

Description

Sonamu UI uses the same port as the API server and is accessed via the /sonamu-ui path.
# Changing API server port
export default {
  server: {
    listen: {
      port: 10280
    }
  }
} satisfies SonamuConfig;
Sonamu UI access: http://localhost:10280/sonamu-ui

Running Multiple Projects Simultaneously

Symptoms

Ports conflict when trying to run multiple Sonamu projects simultaneously.

Solution

Use different ports for each project: Project A:
// sonamu.config.ts
export default {
  server: {
    listen: {
      port: 10280
    }
  }
} satisfies SonamuConfig;
Project B:
// sonamu.config.ts
export default {
  server: {
    listen: {
      port: 10380
    }
  }
} satisfies SonamuConfig;

PostgreSQL Port Conflict

Symptoms

Error: could not connect to server: Connection refused
  Is the server running on host "localhost" (::1) and accepting
  TCP/IP connections on port 5432?

Cause

PostgreSQL is not running, or another process is using port 5432.

Solutions

1. Check PostgreSQL Running

# macOS
brew services list
brew services start postgresql

# Linux
sudo systemctl status postgresql
sudo systemctl start postgresql

2. Run PostgreSQL on Different Port

In PostgreSQL config file (postgresql.conf):
port = 5433  # Use different port
After restart, update .env file:
DB_PORT=5433

3. Check Port Conflict Process

lsof -i :5432