paperclipai/paperclip · error

Config not found at ${configPath}.

Error message

Config not found at ${configPath}.

What it means

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.

Source

Thrown at cli/src/commands/routines.ts:188

    port,
    startedByThisProcess: true,
    stop: async () => {
      await instance.stop();
    },
  };
}

async function closeDb(db: ClosableDb): Promise<void> {
  await db.$client?.end?.({ timeout: 5 }).catch(() => undefined);
}

async function openConfiguredDb(configPath: string): Promise<{
  db: ClosableDb;
  stop: () => Promise<void>;
}> {
  const config = readConfig(configPath);
  if (!config) {
    throw new Error(`Config not found at ${configPath}.`);
  }

  let embeddedHandle: EmbeddedPostgresHandle | null = null;
  try {
    if (config.database.mode === "embedded-postgres") {
      embeddedHandle = await ensureEmbeddedPostgres(
        config.database.embeddedPostgresDataDir,
        config.database.embeddedPostgresPort,
      );
      const adminConnectionString = `postgres://paperclip:paperclip@127.0.0.1:${embeddedHandle.port}/postgres`;
      await ensurePostgresDatabase(adminConnectionString, "paperclip");
      const connectionString = `postgres://paperclip:paperclip@127.0.0.1:${embeddedHandle.port}/paperclip`;
      await applyPendingMigrations(connectionString);
      const db = createDb(connectionString) as ClosableDb;
      return {
        db,
        stop: async () => {
          await closeDb(db);

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Check the resolved path and create the config there: run the CLI's config init/bootstrap command.
  2. If using `--config`, verify the path is absolute or correctly relative to your CWD.
  3. Ensure the file is valid JSON/whatever format readConfig expects and is readable by the current user.

Example fix

# before
paperclipai routines disable-all --config ./paperclip.json
# after (path verified)
paperclipai routines disable-all --config /etc/paperclip/config.json
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'node:fs';
function assertConfigExists(path: string): void {
  if (!fs.existsSync(path)) {
    throw new Error(`Config not found at ${path}. Run the config init command first.`);
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/e29eeaf9c21c95a5. Report an issue: GitHub.