{"record":{"id":"764941c10a0734d5","repo":"paperclipai/paperclip","slug":"invalid-paperclip-config-at-configpath-failed","errorCode":null,"errorMessage":"Invalid Paperclip config at ${configPath}: failed to read or parse JSON: ${reason}","messagePattern":"Invalid Paperclip config at (.+?): failed to read or parse JSON: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/config-file.ts","lineNumber":29,"sourceCode":"  return error.issues\n    .map((issue) => {\n      const issuePath = issue.path.length > 0 ? issue.path.join(\".\") : \"<root>\";\n      return `${issuePath}: ${issue.message}`;\n    })\n    .join(\"; \");\n}\n\nexport function readConfigFile(): PaperclipConfig | null {\n  const configPath = resolvePaperclipConfigPath();\n\n  if (!fs.existsSync(configPath)) return null;\n\n  let raw: unknown;\n  try {\n    raw = JSON.parse(fs.readFileSync(configPath, \"utf-8\"));\n  } catch (error) {\n    const reason = error instanceof Error ? error.message : String(error);\n    throw new Error(`Invalid Paperclip config at ${configPath}: failed to read or parse JSON: ${reason}`);\n  }\n\n  try {\n    const config = paperclipConfigSchema.parse(raw);\n    for (const warning of findPaperclipConfigKeyWarnings(config)) {\n      console.warn(\n        `Unknown config key ${warning.path}; did you mean ${warning.suggestion}? It will be preserved.`,\n      );\n    }\n    return config;\n  } catch (error) {\n    if (error instanceof ZodError) {\n      throw new Error(`Invalid Paperclip config at ${configPath}: ${formatConfigValidationError(error)}`);\n    }\n\n    throw error;\n  }\n}","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/config-file.ts#L11-L47","documentation":"Read/parse failure in readConfigFile: the Paperclip config file exists at the resolved path but fs.readFileSync or JSON.parse threw (unreadable file or invalid JSON). The message embeds the underlying reason so the operator can fix the file; startup aborts rather than silently ignoring config.","triggerScenarios":"Thrown at server/src/config-file.ts:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the JSON syntax in the config file at the reported path, or delete it to use defaults.","Check file permissions so the config file is readable."],"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-14T05:17:10.506Z"}