vercel/next.js · error · SerializableError

Error serializing ` ` returned from ` ` in " ". Reason…

Error message

Error serializing `${path}` returned from `${method}` in "${page}".
Reason: Circular references cannot be expressed in JSON (references: `${visited.get(value) || '(self)'}`).

What it means

Error "Error serializing `${path}` returned from `${method}` in "${page}". Reason: Circular references cannot be expressed in JSON (references: `${visited.get(value) || '(self)'}`)." thrown in vercel/next.js.

Solutions

  1. Remove the circular reference from the returned props; break the cycle or exclude the self-referencing value.
Defensive patterns

Strategy: validation

When it happens

Trigger: Props returned from a data fetching method contain a circular reference.

Common situations: An object graph with cycles is returned from getStaticProps/getServerSideProps and cannot be serialized to JSON.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/0bf9380288b40eb7. Report an issue: GitHub.

Appendix: source

Thrown at packages/next/src/lib/is-serializable-props.ts:36

export function isSerializableProps(
  page: string,
  method: string,
  input: any
): true {
  if (!isPlainObject(input)) {
    throw new SerializableError(
      page,
      method,
      '',
      `Props must be returned as a plain object from ${method}: \`{ props: { ... } }\` (received: \`${getObjectClassLabel(
        input
      )}\`).`
    )
  }

  function visit(visited: Map<any, string>, value: any, path: string) {
    if (visited.has(value)) {
      throw new SerializableError(
        page,
        method,
        path,
        `Circular references cannot be expressed in JSON (references: \`${
          visited.get(value) || '(self)'
        }\`).`
      )
    }

    visited.set(value, path)
  }

  function isSerializable(
    refs: Map<any, string>,
    value: any,
    path: string
  ): true {
    const type = typeof value

View on GitHub (pinned to 0eb3775416)