{"record":{"id":"4dacb0ba9cadd7a2","repo":"JuliusBrussee/caveman","slug":"path-must-be-a-plain-object-array-or-primitiv","errorCode":null,"errorMessage":"${path} must be a plain object, array, or primitive","messagePattern":"(.+?) must be a plain object, array, or primitive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mastra/src/index.ts","lineNumber":748,"sourceCode":" * plain object, array, string, finite number, boolean, or null — a Date, a Map,\n * or a class instance would serialize into something the caller did not mean,\n * and the record's digest is its identity.\n */\nexport function stableStringify(value: unknown, path = \"value\"): string {\n  if (value === null) return \"null\";\n  switch (typeof value) {\n    case \"string\":\n      return JSON.stringify(value);\n    case \"boolean\":\n      return value ? \"true\" : \"false\";\n    case \"number\":\n      if (!Number.isFinite(value)) throw new Error(`${path} must be a finite number`);\n      return JSON.stringify(value);\n    case \"object\": {\n      if (Array.isArray(value)) {\n        return `[${value.map((item, i) => stableStringify(item, `${path}[${i}]`)).join(\",\")}]`;\n      }\n      if (!isPlainObject(value)) throw new Error(`${path} must be a plain object, array, or primitive`);\n      const entries = Object.entries(value).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));\n      return `{${entries\n        .map(([key, item]) => `${JSON.stringify(key)}:${stableStringify(item, `${path}.${key}`)}`)\n        .join(\",\")}}`;\n    }\n    default:\n      throw new Error(`${path} must be JSON data (got ${typeof value})`);\n  }\n}\n\n// ---------------------------------------------------------------------------\n// 5. Deep links\n// ---------------------------------------------------------------------------\n\n/**\n * Mastra Studio's documented default address. The dev server listens on 4111\n * (or `PORT`): https://mastra.ai/docs/studio/overview\n */","sourceCodeStart":730,"sourceCodeEnd":766,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/packages/mastra/src/index.ts#L730-L766","documentation":"Error \"${path} must be a plain object, array, or primitive\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at packages/mastra/src/index.ts:748 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a plain object, array, or primitive at the indicated path (no functions or class instances)."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}