paperclipai/paperclip · error · Error

Invalid config at

Error message

Invalid config at ${filePath}: ${formatValidationError(parsed.error)}

What it means

readConfig parsed the JSON config against paperclipConfigSchema and validation failed; the message lists the offending field paths and reasons.

Solutions

  1. Correct the invalid fields listed in the validation error at ${filePath}.
  2. Regenerate the config by removing the file and re-running setup.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/config/store.ts:98 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/aacfe94902f4142b. Report an issue: GitHub.

Appendix: source

Thrown at cli/src/config/store.ts:98

      .map((issue) => {
        const pathParts = Array.isArray(issue.path) ? issue.path.map(String) : [];
        const issuePath = pathParts.length > 0 ? pathParts.join(".") : "config";
        const message = typeof issue.message === "string" ? issue.message : "Invalid value";
        return `${issuePath}: ${message}`;
      })
      .join("; ");
  }
  return err instanceof Error ? err.message : String(err);
}

export function readConfig(configPath?: string): PaperclipConfig | null {
  const filePath = resolveConfigPath(configPath);
  if (!fs.existsSync(filePath)) return null;
  const raw = parseJson(filePath);
  const migrated = migrateLegacyConfig(raw);
  const parsed = paperclipConfigSchema.safeParse(migrated);
  if (!parsed.success) {
    throw new Error(`Invalid config at ${filePath}: ${formatValidationError(parsed.error)}`);
  }
  return parsed.data;
}

function effectiveConfig(config: PaperclipConfig): Record<string, unknown> {
  const meta = { ...config.$meta } as Record<string, unknown>;
  delete meta.updatedAt;
  delete meta.source;
  return {
    ...config,
    $meta: meta,
  };
}

function syncDirectory(directoryPath: string): void {
  let directoryDescriptor: number | null = null;
  try {
    directoryDescriptor = fs.openSync(directoryPath, "r");

View on GitHub (pinned to 120ae5428f)