{"record":{"id":"e26dc187ace05e08","repo":"paperclipai/paperclip","slug":"cannot-back-up-missing-config-at-filepath","errorCode":null,"errorMessage":"Cannot back up missing config at ${filePath}","messagePattern":"Cannot back up missing config at (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/config/store.ts","lineNumber":170,"sourceCode":"      fs.closeSync(fileDescriptor);\n      fileDescriptor = null;\n      fs.renameSync(temporaryPath, filePath);\n      syncDirectory(path.dirname(filePath));\n      return;\n    } catch (error) {\n      if (fileDescriptor !== null) fs.closeSync(fileDescriptor);\n      fs.rmSync(temporaryPath, { force: true });\n      const code = error instanceof Error && \"code\" in error ? error.code : null;\n      if (code === \"EEXIST\") continue;\n      throw error;\n    }\n  }\n}\n\nexport function backupInvalidConfig(configPath?: string): string {\n  const filePath = resolveConfigPath(configPath);\n  if (!fs.existsSync(filePath)) {\n    throw new Error(`Cannot back up missing config at ${filePath}`);\n  }\n\n  for (let suffix = 1; ; suffix += 1) {\n    const backupPath = `${filePath}.invalid-${suffix}`;\n    try {\n      durableCopyFile(filePath, backupPath, fs.constants.COPYFILE_EXCL);\n      return backupPath;\n    } catch (error) {\n      const code = error instanceof Error && \"code\" in error ? error.code : null;\n      if (code === \"EEXIST\") continue;\n      throw error;\n    }\n  }\n}\n\nexport function writeConfig(\n  config: PaperclipConfig,\n  configPath?: string,","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/config/store.ts#L152-L188","documentation":"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.","triggerScenarios":"Thrown at cli/src/config/store.ts:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the config at ${filePath} first, or verify the path is correct."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}