{"record":{"id":"d857345f9228636f","repo":"paperclipai/paperclip","slug":"source-instance-uses-postgres-mode-but-has-no-conn","errorCode":null,"errorMessage":"Source instance uses postgres mode but has no connection string in config or adjacent .env.","messagePattern":"Source instance uses postgres mode but has no connection string in config or adjacent \\.env\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":1043,"sourceCode":"    throw new Error(extractExecSyncErrorMessage(error) ?? String(error));\n  }\n\n  installDependenciesBestEffort(targetPath);\n\n  return {\n    rootPath: targetPath,\n    configPath: path.resolve(targetPath, \".paperclip\", \"config.json\"),\n    label: branchName,\n    branchName,\n    created: true,\n  };\n}\n\nfunction resolveSourceConnectionString(config: PaperclipConfig, envEntries: Record<string, string>, portOverride?: number): string {\n  if (config.database.mode === \"postgres\") {\n    const connectionString = nonEmpty(envEntries.DATABASE_URL) ?? nonEmpty(config.database.connectionString);\n    if (!connectionString) {\n      throw new Error(\n        \"Source instance uses postgres mode but has no connection string in config or adjacent .env.\",\n      );\n    }\n    return connectionString;\n  }\n\n  const port = portOverride ?? config.database.embeddedPostgresPort;\n  return `postgres://paperclip:paperclip@127.0.0.1:${port}/paperclip`;\n}\n\nexport function copySeededSecretsKey(input: {\n  sourceConfigPath: string;\n  sourceConfig: PaperclipConfig;\n  sourceEnvEntries: Record<string, string>;\n  targetKeyFilePath: string;\n}): void {\n  if (input.sourceConfig.secrets.provider !== \"local_encrypted\") {\n    return;","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L1025-L1061","documentation":"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.","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:1027 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add the postgres connection string to the source instance config or its adjacent .env."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}