paperclipai/paperclip · error
Embedded PostgreSQL appears to already be reachable without
Error message
Embedded PostgreSQL appears to already be reachable without a pid file; reusing existing server on configured port ${configuredPort} What it means
Startup warning (logger.warn) in startServer's embedded PostgreSQL bootstrap. Fires when no pid file exists but a PostgreSQL server is already reachable on the configured port whose data directory matches; the server adopts the existing process instead of failing the port bind.
Source
Thrown at server/src/index.ts:516
if (!existsSync(postmasterPidFile)) return null;
try {
const pidLine = readFileSync(postmasterPidFile, "utf8").split("\n")[0]?.trim();
const pid = Number(pidLine);
if (!Number.isInteger(pid) || pid <= 0) return null;
if (!isPidRunning(pid)) return null;
return pid;
} catch {
return null;
}
};
const runningPid = getRunningPid();
if (runningPid) {
logger.warn(`Embedded PostgreSQL already running; reusing existing process (pid=${runningPid}, port=${port})`);
} else {
const configuredAdminConnectionString = `postgres://paperclip:paperclip@127.0.0.1:${configuredPort}/postgres`;
try {
const actualDataDir = await getPostgresDataDirectory(configuredAdminConnectionString);
if (
typeof actualDataDir !== "string" ||
resolve(actualDataDir) !== resolve(dataDir)
) {
throw new Error("reachable postgres does not use the expected embedded data directory");
}
await ensurePostgresDatabase(configuredAdminConnectionString, "paperclip");
logger.warn(
`Embedded PostgreSQL appears to already be reachable without a pid file; reusing existing server on configured port ${configuredPort}`,
);
} catch {
const detectedPort = await detectPort(configuredPort);
if (detectedPort !== configuredPort) {
logger.warn(`Embedded PostgreSQL port is in use; using next free port (requestedPort=${configuredPort}, selectedPort=${detectedPort})`);
}
port = detectedPort;
logger.info(`Using embedded PostgreSQL because no DATABASE_URL set (dataDir=${dataDir}, port=${port})`);
const createEmbeddedPostgres = () => new EmbeddedPostgres({View on GitHub (pinned to 01ad858492)
Solutions
- Informational only; the server attached to an existing embedded PostgreSQL reachable on the configured port.
- If this is unexpected, check for a leftover PostgreSQL process on that port and stop it.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at server/src/index.ts:443 when the library encounters an invalid state.
Common situations: Logged at startup when no pid file exists but a PostgreSQL server is already accepting connections on the configured embedded port.
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18).
Data as JSON: /api/errors/2d809806b781209d.
Report an issue: GitHub.