paperclipai/paperclip · error
Invalid Paperclip config at ${configPath}: failed to read or
Error message
Invalid Paperclip config at ${configPath}: failed to read or parse JSON: ${reason} What it means
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.
Source
Thrown at server/src/config-file.ts:29
return error.issues
.map((issue) => {
const issuePath = issue.path.length > 0 ? issue.path.join(".") : "<root>";
return `${issuePath}: ${issue.message}`;
})
.join("; ");
}
export function readConfigFile(): PaperclipConfig | null {
const configPath = resolvePaperclipConfigPath();
if (!fs.existsSync(configPath)) return null;
let raw: unknown;
try {
raw = JSON.parse(fs.readFileSync(configPath, "utf-8"));
} catch (error) {
const reason = error instanceof Error ? error.message : String(error);
throw new Error(`Invalid Paperclip config at ${configPath}: failed to read or parse JSON: ${reason}`);
}
try {
const config = paperclipConfigSchema.parse(raw);
for (const warning of findPaperclipConfigKeyWarnings(config)) {
console.warn(
`Unknown config key ${warning.path}; did you mean ${warning.suggestion}? It will be preserved.`,
);
}
return config;
} catch (error) {
if (error instanceof ZodError) {
throw new Error(`Invalid Paperclip config at ${configPath}: ${formatConfigValidationError(error)}`);
}
throw error;
}
}View on GitHub (pinned to 120ae5428f)
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.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/src/config-file.ts:29 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/764941c10a0734d5.
Report an issue: GitHub.