paperclipai/paperclip · error · Error

Cannot back up missing config at

Error message

Cannot back up missing config at ${filePath}

What it means

backupInvalidConfig was asked to back up a config file that does not exist at the resolved path, so there is nothing to copy to a backup.

Solutions

  1. Create the config at ${filePath} first, or verify the path is correct.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/config/store.ts:170 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/e26dc187ace05e08. Report an issue: GitHub.

Appendix: source

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

      fs.closeSync(fileDescriptor);
      fileDescriptor = null;
      fs.renameSync(temporaryPath, filePath);
      syncDirectory(path.dirname(filePath));
      return;
    } catch (error) {
      if (fileDescriptor !== null) fs.closeSync(fileDescriptor);
      fs.rmSync(temporaryPath, { force: true });
      const code = error instanceof Error && "code" in error ? error.code : null;
      if (code === "EEXIST") continue;
      throw error;
    }
  }
}

export function backupInvalidConfig(configPath?: string): string {
  const filePath = resolveConfigPath(configPath);
  if (!fs.existsSync(filePath)) {
    throw new Error(`Cannot back up missing config at ${filePath}`);
  }

  for (let suffix = 1; ; suffix += 1) {
    const backupPath = `${filePath}.invalid-${suffix}`;
    try {
      durableCopyFile(filePath, backupPath, fs.constants.COPYFILE_EXCL);
      return backupPath;
    } catch (error) {
      const code = error instanceof Error && "code" in error ? error.code : null;
      if (code === "EEXIST") continue;
      throw error;
    }
  }
}

export function writeConfig(
  config: PaperclipConfig,
  configPath?: string,

View on GitHub (pinned to 120ae5428f)