paperclipai/paperclip · error
Invalid config at ${configPath}: expected a JSON object
Error message
Invalid config at ${configPath}: expected a JSON object What it means
Error "Invalid config at ${configPath}: expected a JSON object" thrown in paperclipai/paperclip.
Source
Thrown at packages/db/src/runtime-config.ts:156
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: database
? {
mode: database.mode === "postgres" ? "postgres" : "embedded-postgres",
connectionString:
typeof database.connectionString === "string" ? database.connectionString : undefined,
embeddedPostgresDataDir:
typeof database.embeddedPostgresDataDir === "string"
? database.embeddedPostgresDataDirView on GitHub (pinned to 120ae5428f)
Solutions
- Ensure the config file contains a top-level JSON object `{...}`, not an array or scalar.
When it happens
Trigger: Thrown at packages/db/src/runtime-config.ts:156 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/51965efe8abdb769.
Report an issue: GitHub.