{"record":{"id":"e29eeaf9c21c95a5","repo":"paperclipai/paperclip","slug":"config-not-found-at-configpath","errorCode":null,"errorMessage":"Config not found at ${configPath}.","messagePattern":"Config not found at (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/routines.ts","lineNumber":188,"sourceCode":"    port,\n    startedByThisProcess: true,\n    stop: async () => {\n      await instance.stop();\n    },\n  };\n}\n\nasync function closeDb(db: ClosableDb): Promise<void> {\n  await db.$client?.end?.({ timeout: 5 }).catch(() => undefined);\n}\n\nasync function openConfiguredDb(configPath: string): Promise<{\n  db: ClosableDb;\n  stop: () => Promise<void>;\n}> {\n  const config = readConfig(configPath);\n  if (!config) {\n    throw new Error(`Config not found at ${configPath}.`);\n  }\n\n  let embeddedHandle: EmbeddedPostgresHandle | null = null;\n  try {\n    if (config.database.mode === \"embedded-postgres\") {\n      embeddedHandle = await ensureEmbeddedPostgres(\n        config.database.embeddedPostgresDataDir,\n        config.database.embeddedPostgresPort,\n      );\n      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);","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/routines.ts#L170-L206","documentation":"Thrown by openConfiguredDb() when readConfig(configPath) returns a falsy value, meaning the config file does not exist or could not be parsed at the resolved path. It guards every downstream database operation that needs connection details.","triggerScenarios":"Calling a routines command (which uses openConfiguredDb) when the config file at the resolved path (default or `--config <path>`) does not exist, is unreadable, or is empty/invalid so readConfig returns null.","commonSituations":"First run on a new machine without a generated config; pointing `--config` at a typo'd path; config deleted by a clean/reset; wrong working directory making a relative path resolve elsewhere.","solutions":["Check the resolved path and create the config there: run the CLI's config init/bootstrap command.","If using `--config`, verify the path is absolute or correctly relative to your CWD.","Ensure the file is valid JSON/whatever format readConfig expects and is readable by the current user."],"exampleFix":"# before\npaperclipai routines disable-all --config ./paperclip.json\n# after (path verified)\npaperclipai routines disable-all --config /etc/paperclip/config.json","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nfunction assertConfigExists(path: string): void {\n  if (!fs.existsSync(path)) {\n    throw new Error(`Config not found at ${path}. Run the config init command first.`);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an absolute --config path in automation.","Bootstrap new machines with the config init command before any routines command."],"tags":["config","file-not-found","routines","database"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}