Fixed: "imsg rpc exited with code 1"

This is the most common startup crash for Moltbot. It usually means the internal messaging system failed to bind to a port or encountered a Node.js version mismatch.

The Error Log

Error: imsg rpc exited with code 1
    at ChildProcess.<anonymous> ...
    at ChildProcess.emit (node:events:513:28)

Solution 1: Port Conflict (Most Common)

Moltbot tries to use port 3000 or 8080 internally. If another process (like another bot instance or a web server) is using it, the RPC fails.

Check for processes using the port:

lsof -i :3000

Kill the process (replace PID):

kill -9 <PID>

Solution 2: Node.js Version Mismatch

Moltbot requires Node.js 20+. Older versions (16/18) can cause RPC failures due to missing fetch or crypto APIs.

Check your version:

node -v

If it is not v20+, update it using nvm or your package manager.

Solution 3: Use Docker (Guaranteed Fix)

If you are tired of debugging local environment issues, switch to Docker. It isolates the environment completely.

docker run -d \
  --name moltbot \
  -e ANTHROPIC_API_KEY="your_key" \
  moltbot/moltbot:latest