Symptom
When executing the openclaw start or openclaw serve command, the program fails immediately and outputs the following error message:
Error: listen EADDRINUSE :::3000
at Server.setupListenHandler [as _listeningListener] (node:net:1465:14)
at ListenAndServe (node:net:1398:7)
at ListenAndServe (net:http:1801:9)
...
This indicates that the port OpenClaw is trying to bind to (default 3000) is already occupied by another process.
Root Cause Analysis
- Port Conflict: Another service on the local computer (such as a Node.js app, Apache, Nginx, or another OpenClaw instance) is already using port 3000.
- Zombie Process: A previous OpenClaw process might not have terminated properly and is still holding the port.
- Configuration Error: The user might have set an already occupied port in the configuration file.
Solution
Method 1: Find and terminate the process occupying the port
macOS / Linux:
|
|
Windows:
|
|
Method 2: Specify a different port using the configuration file
Create or modify openclaw.config.js in the project root directory:
|
|
Then restart:
|
|
Method 3: Temporarily specify a port using command-line arguments
|
|
Method 4: Use Environment Variables
|
|
Prevention
- Clean up residual processes using
pkill: Executepkill -f openclawbefore starting to ensure no residual processes are left. - Use a port checking script: Create a pre-start checking script.
- Configure health checks: Add port availability checks in
openclaw.config.js.
Additional Information
- OpenClaw’s default port can be modified in the
server.portfield of the configuration file. - Dynamically specifying the port via the
OPENCLAW_PORTenvironment variable is supported. - It is recommended to use unregistered ports in the range 3000-9999.