paperclipai/paperclip · warning

Database mode is postgres but no connection string was set;

Error message

Database mode is postgres but no connection string was set; falling back to embedded PostgreSQL

What it means

config.databaseMode is 'postgres' but no connection string was configured, so the server silently falls back to the embedded PostgreSQL cluster under its data directory. The API works, but data lands in local embedded storage instead of the external/managed Postgres the mode implies — a classic prod misconfiguration.

Source

Thrown at server/src/index.ts:474

      const lines = typeof message === "string"
        ? message.split(/\r?\n/)
        : message instanceof Error
          ? [message.message]
          : [String(message ?? "")];
      for (const lineRaw of lines) {
        const line = lineRaw.trim();
        if (!line) continue;
        logger.info({ embeddedPostgresLog: line }, "embedded-postgres");
      }
    };
    const logEmbeddedPostgresFailure = (phase: "initialise" | "start", err: unknown) => {
      const recentLogs = logBuffer.getRecentLogs();
      if (recentLogs.length > 0) {
        logger.error(
          {
            phase,
            recentLogs,
            err,
          },
          "Embedded PostgreSQL failed; showing buffered startup logs",
        );
      }
    };
  
    if (config.databaseMode === "postgres") {
      logger.warn("Database mode is postgres but no connection string was set; falling back to embedded PostgreSQL");
    }
  
    const clusterVersionFile = resolve(dataDir, "PG_VERSION");
    const clusterAlreadyInitialized = existsSync(clusterVersionFile);
    const postmasterPidFile = resolve(dataDir, "postmaster.pid");
    const isPidRunning = (pid: number): boolean => {
      try {
        process.kill(pid, 0);
        return true;
      } catch {

View on GitHub (pinned to 01ad858492)

Solutions

  1. Set the Postgres connection string (DATABASE_URL or the config's connection field) in the server environment and restart.
  2. Verify inside the actual runtime: `printenv DATABASE_URL` in the container, not just locally.
  3. If embedded was actually intended, set databaseMode to the embedded value so intent is explicit and the warn disappears.
  4. Check the secret-provider wiring (vault/devkey) that supplies the URL.

Example fix

# before (unset)
# after
export DATABASE_URL=postgres://user:pass@db.internal:5432/paperclip
Defensive patterns

Strategy: validation

Validate before calling

// Fail fast instead of silently falling back to embedded PG.
if (config.databaseMode === 'postgres' && !connectionString) {
  throw new Error('databaseMode=postgres but no connection string is set; refusing to fall back to embedded');
}

Prevention

When it happens

Trigger: databaseMode=postgres while the connection string env/config is unset in the server's environment — dropped container env vars, an .env file not loaded in production, or a failed secret injection.

Common situations: Kubernetes/Helm values missing the DB secret reference; CI and prod env divergence; dotenv files excluded from production bundles; secret-manager outages during deploy.

Related errors


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18). Data as JSON: /api/errors/d191d5406244d6eb. Report an issue: GitHub.