paperclipai/paperclip · error
Failed to parse config at ${configPath}: ${err instanceof Er
Error message
Failed to parse config at ${configPath}: ${err instanceof Error ? err.message : String(err)} What it means
Error "Failed to parse config at ${configPath}: ${err instanceof Error ? err.message : String(err)}" thrown in paperclipai/paperclip.
Source
Thrown at packages/db/src/runtime-config.ts:149
config.database = database;
return config as PartialConfig;
}
function asPositiveInt(value: unknown): number | null {
if (typeof value !== "number" || !Number.isFinite(value)) return null;
const rounded = Math.trunc(value);
return rounded > 0 ? rounded : null;
}
function readConfig(configPath: string): PartialConfig | null {
if (!existsSync(configPath)) return null;
let parsed: unknown;
try {
parsed = JSON.parse(readFileSync(configPath, "utf8"));
} catch (err) {
throw new Error(
`Failed to parse config at ${configPath}: ${err instanceof Error ? err.message : String(err)}`,
);
}
const migrated = migrateLegacyConfig(parsed);
if (migrated === null || typeof migrated !== "object" || Array.isArray(migrated)) {
throw new Error(`Invalid config at ${configPath}: expected a JSON object`);
}
const database =
typeof migrated.database === "object" &&
migrated.database !== null &&
!Array.isArray(migrated.database)
? migrated.database
: undefined;
return {
database: databaseView on GitHub (pinned to 120ae5428f)
Solutions
- Fix the JSON syntax error in the config file at the reported path.
- Delete the config file to regenerate defaults if it is corrupted.
When it happens
Trigger: Thrown at packages/db/src/runtime-config.ts:149 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18).
Data as JSON: /api/errors/2beb6b1a8f548bab.
Report an issue: GitHub.