paperclipai/paperclip · error

Source instance uses postgres mode but has no connection…

Error message

Source instance uses postgres mode but has no connection string in config or adjacent .env.

What it means

Configuration completeness guard when seeding a worktree database from a source instance: the source config declares postgres mode but neither the adjacent .env nor the config itself provides a DATABASE_URL connection string to copy from.

Solutions

  1. Add the postgres connection string to the source instance config or its adjacent .env.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/worktree.ts:1027 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at cli/src/commands/worktree.ts:1043

    throw new Error(extractExecSyncErrorMessage(error) ?? String(error));
  }

  installDependenciesBestEffort(targetPath);

  return {
    rootPath: targetPath,
    configPath: path.resolve(targetPath, ".paperclip", "config.json"),
    label: branchName,
    branchName,
    created: true,
  };
}

function resolveSourceConnectionString(config: PaperclipConfig, envEntries: Record<string, string>, portOverride?: number): string {
  if (config.database.mode === "postgres") {
    const connectionString = nonEmpty(envEntries.DATABASE_URL) ?? nonEmpty(config.database.connectionString);
    if (!connectionString) {
      throw new Error(
        "Source instance uses postgres mode but has no connection string in config or adjacent .env.",
      );
    }
    return connectionString;
  }

  const port = portOverride ?? config.database.embeddedPostgresPort;
  return `postgres://paperclip:paperclip@127.0.0.1:${port}/paperclip`;
}

export function copySeededSecretsKey(input: {
  sourceConfigPath: string;
  sourceConfig: PaperclipConfig;
  sourceEnvEntries: Record<string, string>;
  targetKeyFilePath: string;
}): void {
  if (input.sourceConfig.secrets.provider !== "local_encrypted") {
    return;

View on GitHub (pinned to 01ad858492)