paperclipai/paperclip · error · Error

Config not found at ${configPath}.

Error message

Config not found at ${configPath}.

What it means

Thrown by openConfiguredStorage when readConfig(configPath) returns a falsy value, meaning no readable Paperclip config file exists at the given path. The worktree storage command requires a valid config to construct the storage backend and refuses to proceed with an undefined config.

Source

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

      assertStorageCompanyPrefix(companyId, objectKey);
      const { sdk, client } = await getS3Client();
      await client.send(
        new sdk.PutObjectCommand({
          Bucket: bucket,
          Key: buildS3ObjectKey(prefix, objectKey),
          Body: body,
          ContentType: contentType,
          ContentLength: body.length,
        }),
      );
    },
  };
}

function openConfiguredStorage(configPath: string): ConfiguredStorage {
  const config = readConfig(configPath);
  if (!config) {
    throw new Error(`Config not found at ${configPath}.`);
  }
  return createConfiguredStorageFromPaperclipConfig(config);
}

async function streamToBuffer(stream: NodeJS.ReadableStream): Promise<Buffer> {
  const chunks: Buffer[] = [];
  for await (const chunk of stream) {
    chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
  }
  return Buffer.concat(chunks);
}

export function isMissingStorageObjectError(error: unknown): boolean {
  if (!error || typeof error !== "object") return false;
  const candidate = error as { code?: unknown; status?: unknown; name?: unknown; message?: unknown };
  return candidate.code === "ENOENT"
    || candidate.status === 404
    || candidate.name === "NoSuchKey"

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Run `paperclipai worktree init` (or the equivalent init) in the target worktree to generate .paperclip/config.json.
  2. Pass an explicit --config path that points to an existing .paperclip/config.json.
  3. Verify the path exists with ls/stat before invoking the command.
  4. Set PAPERCLIP_CONFIG or run the command from inside the worktree root.

Example fix

// before
openConfiguredStorage('/wrong/path/config.json')
// after
const configPath = path.resolve(worktreeRoot, '.paperclip', 'config.json');
if (!fs.existsSync(configPath)) throw new Error('Run `paperclipai worktree init` first.');
openConfiguredStorage(configPath);
Defensive patterns

Strategy: validation

Validate before calling

function configExists(configPath: string): boolean {
  return fs.existsSync(configPath) && Boolean(JSON.parse(fs.readFileSync(configPath, 'utf8') ?? 'null'));
}

Type guard

function isReadableConfig(configPath: string): configPath is string {
  try { return Boolean(readConfig(configPath)); } catch { return false; }
}

Try / catch

if (!fs.existsSync(configPath)) {
  console.error('Run `paperclipai worktree init` first; no config at', configPath);
  process.exit(1);
}
try { openConfiguredStorage(configPath); } catch (e) { /* surface message */ }

Prevention

When it happens

Trigger: Invoking a worktree storage subcommand with --config pointing at a path that does not exist or is not a Paperclip config JSON; running from a directory with no .paperclip/config.json and no PAPERCLIP_CONFIG env; passing a relative path that resolves against an unexpected cwd.

Common situations: Worktree was never initialized (paperclipai worktree init not run); config.json deleted or never copied; wrong --config flag value; running the storage command from the repo root instead of the worktree directory; HOME/data-dir misconfiguration.

Related errors


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