vercel/next.js · error · SerializableError

Error serializing props returned from

Error message

Error serializing props returned from `${method}` in "${page}".
Reason: Props must be returned as a plain object from ${method}: `{ props: { ... } }` (received: `${getObjectClassLabel(input)}`).

What it means

Error "Error serializing props returned from `${method}` in "${page}". Reason: Props must be returned as a plain object from ${method}: `{ props: { ... } }` (received: `${getObjectClassLabel(input)}`)." thrown in vercel/next.js.

Solutions

  1. Return props as a plain object: return { props: { ... } } from the data fetching method.
Defensive patterns

Strategy: validation

When it happens

Trigger: getStaticProps/getServerSideProps returns a non-plain-object value.

Common situations: Returning a class instance, array, or primitive instead of { props: {...} } from a data fetching method.


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

Appendix: source

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

const regexpPlainIdentifier = /^[A-Za-z_$][A-Za-z0-9_$]*$/

export class SerializableError extends Error {
  constructor(page: string, method: string, path: string, message: string) {
    super(
      path
        ? `Error serializing \`${path}\` returned from \`${method}\` in "${page}".\nReason: ${message}`
        : `Error serializing props returned from \`${method}\` in "${page}".\nReason: ${message}`
    )
  }
}

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)'
        }\`).`

View on GitHub (pinned to 0eb3775416)