{"record":{"id":"93bbebf4ea8b245b","repo":"vercel/next.js","slug":"error-serializing-path-returned-from-metho-93bbeb","errorCode":null,"errorMessage":"Error serializing `${path}` returned from `${method}` in \"${page}\".\nReason: invariant: Unknown error encountered in Array.","messagePattern":"Error serializing `(.+?)` returned from `(.+?)` in \"(.+?)\"\\.\nReason: invariant: Unknown error encountered in Array\\.","errorType":"exception","errorClass":"SerializableError","httpStatus":null,"severity":"error","filePath":"packages/next/src/lib/is-serializable-props.ts","lineNumber":118,"sourceCode":"        method,\n        path,\n        `invariant: Unknown error encountered in Object.`\n      )\n    }\n\n    if (Array.isArray(value)) {\n      visit(refs, value, path)\n\n      if (\n        value.every((nestedValue, index) => {\n          const newRefs = new Map(refs)\n          return isSerializable(newRefs, nestedValue, `${path}[${index}]`)\n        })\n      ) {\n        return true\n      }\n\n      throw new SerializableError(\n        page,\n        method,\n        path,\n        `invariant: Unknown error encountered in Array.`\n      )\n    }\n\n    // None of these can be expressed as JSON:\n    // const type: \"bigint\" | \"symbol\" | \"object\" | \"function\"\n    throw new SerializableError(\n      page,\n      method,\n      path,\n      '`' +\n        type +\n        '`' +\n        (type === 'object'\n          ? ` (\"${Object.prototype.toString.call(value)}\")`","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/packages/next/src/lib/is-serializable-props.ts#L100-L136","documentation":"Thrown by isSerializableProps() as a defensive invariant when an Array passes Array.isArray and begins traversal, but the recursive every() check returns false without any inner check throwing. Like [116] for the Object branch, this is the 'unreachable' guard for arrays; reaching it implies the per-element isSerializable returned false unexpectedly rather than throwing a precise SerializableError.","triggerScenarios":"Reachable only if an array element causes isSerializable to return false silently. In practice the element-level checks throw before this line. Observed only with exotic element types or a framework regression.","commonSituations":"Rare. Possible with arrays containing Proxies, sparse arrays with holes, or arrays whose elements have been frozen/sealed in ways that interfere with traversal. Also possible from an internal serializer bug.","solutions":["Normalize the array: `[...arr]` and map elements through JSON.parse(JSON.stringify(x)) before returning.","Replace Proxy/exotic elements with plain values.","If reproducible with normal data, report a Next.js bug — this branch should be unreachable.","Update to the latest Next.js patch."],"exampleFix":"// before\nreturn { props: { items: new Proxy([], {}) } }\n// after\nreturn { props: { items: [...plainItems] } }","handlingStrategy":"validation","validationCode":"function normalizeArray(arr: unknown[]): unknown[] {\n  return JSON.parse(JSON.stringify(arr))\n}\n// return { props: { items: normalizeArray(rawItems) } }","typeGuard":"function isPlainArray(v: unknown): v is unknown[] {\n  return Array.isArray(v) && v.every((i) =>\n    i === null || typeof i !== 'object' || Object.getPrototypeOf(i) === Object.prototype)\n}","tryCatchPattern":null,"preventionTips":["Map array elements to plain objects before returning.","Avoid Proxy/sparse arrays in props.","Round-trip through JSON to flatten exotic elements."],"tags":["serialization","invariant","array","getstaticprops","build"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}