JuliusBrussee/caveman · error
${path} must be a plain object, array, or primitive
Error message
${path} must be a plain object, array, or primitive What it means
Error "${path} must be a plain object, array, or primitive" thrown in JuliusBrussee/caveman.
Source
Thrown at packages/mastra/src/index.ts:748
* plain object, array, string, finite number, boolean, or null — a Date, a Map,
* or a class instance would serialize into something the caller did not mean,
* and the record's digest is its identity.
*/
export function stableStringify(value: unknown, path = "value"): string {
if (value === null) return "null";
switch (typeof value) {
case "string":
return JSON.stringify(value);
case "boolean":
return value ? "true" : "false";
case "number":
if (!Number.isFinite(value)) throw new Error(`${path} must be a finite number`);
return JSON.stringify(value);
case "object": {
if (Array.isArray(value)) {
return `[${value.map((item, i) => stableStringify(item, `${path}[${i}]`)).join(",")}]`;
}
if (!isPlainObject(value)) throw new Error(`${path} must be a plain object, array, or primitive`);
const entries = Object.entries(value).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));
return `{${entries
.map(([key, item]) => `${JSON.stringify(key)}:${stableStringify(item, `${path}.${key}`)}`)
.join(",")}}`;
}
default:
throw new Error(`${path} must be JSON data (got ${typeof value})`);
}
}
// ---------------------------------------------------------------------------
// 5. Deep links
// ---------------------------------------------------------------------------
/**
* Mastra Studio's documented default address. The dev server listens on 4111
* (or `PORT`): https://mastra.ai/docs/studio/overview
*/View on GitHub (pinned to 27d5a3981a)
Solutions
- Pass a plain object, array, or primitive at the indicated path (no functions or class instances).
When it happens
Trigger: Thrown at packages/mastra/src/index.ts:748 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/4dacb0ba9cadd7a2.
Report an issue: GitHub.