{"record":{"id":"377b3cec3ac19d5c","repo":"paperclipai/paperclip","slug":"config-at-configpath-does-not-define-a-database","errorCode":null,"errorMessage":"Config at ${configPath} does not define a database connection string.","messagePattern":"Config at (.+?) does not define a database connection string\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/routines.ts","lineNumber":216,"sourceCode":"      const adminConnectionString = `postgres://paperclip:paperclip@127.0.0.1:${embeddedHandle.port}/postgres`;\n      await ensurePostgresDatabase(adminConnectionString, \"paperclip\");\n      const connectionString = `postgres://paperclip:paperclip@127.0.0.1:${embeddedHandle.port}/paperclip`;\n      await applyPendingMigrations(connectionString);\n      const db = createDb(connectionString) as ClosableDb;\n      return {\n        db,\n        stop: async () => {\n          await closeDb(db);\n          if (embeddedHandle?.startedByThisProcess) {\n            await embeddedHandle.stop().catch(() => undefined);\n          }\n        },\n      };\n    }\n\n    const connectionString = nonEmpty(config.database.connectionString);\n    if (!connectionString) {\n      throw new Error(`Config at ${configPath} does not define a database connection string.`);\n    }\n\n    await applyPendingMigrations(connectionString);\n    const db = createDb(connectionString) as ClosableDb;\n    return {\n      db,\n      stop: async () => {\n        await closeDb(db);\n      },\n    };\n  } catch (error) {\n    if (embeddedHandle?.startedByThisProcess) {\n      await embeddedHandle.stop().catch(() => undefined);\n    }\n    throw error;\n  }\n}\n","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/routines.ts#L198-L234","documentation":"Thrown by openConfiguredDb() in the non-embedded branch when `nonEmpty(config.database.connectionString)` is falsy. The config exists but its database block omits a connection string while not using embedded-postgres mode, so there is no way to reach the database.","triggerScenarios":"Config file parses successfully, `config.database.mode` is not `embedded-postgres`, but `config.database.connectionString` is missing, empty, or whitespace-only. Produced at routines.ts:216.","commonSituations":"Configuring for external postgres but forgetting the connectionString field; setting an env var placeholder that resolves empty; partial config from a template that left the field blank.","solutions":["Add a non-empty `database.connectionString` to your config file.","Or switch `database.mode` to `embedded-postgres` if you want the bundled DB instead.","Confirm the connection string is not sourced from an unset environment variable."],"exampleFix":"// before\n{ \"database\": { \"mode\": \"postgres\" } }\n// after\n{ \"database\": { \"mode\": \"postgres\", \"connectionString\": \"postgres://user:pass@host:5432/db\" } }","handlingStrategy":"validation","validationCode":"function assertConnectionString(config: {database: {mode: string; connectionString?: string}}, path: string): void {\n  if (config.database.mode !== 'embedded-postgres' && !config.database.connectionString?.trim()) {\n    throw new Error(`Config at ${path} needs a non-empty database.connectionString.`);\n  }\n}","typeGuard":"function hasConnectionString(c: unknown): c is {database: {connectionString: string}} {\n  return typeof c === 'object' && c !== null &&\n    typeof (c as any).database?.connectionString === 'string' &&\n    (c as any).database.connectionString.trim() !== '';\n}","tryCatchPattern":null,"preventionTips":["Validate config schema at load time with a zod/json-schema validator that requires connectionString when mode != embedded-postgres.","Avoid interpolating env vars into config without a fallback check."],"tags":["config","database","connection-string","routines"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}