{"record":{"id":"6eda8df6e4f3c428","repo":"facebook/react","slug":"498","errorCode":"498","errorMessage":"Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.%s","messagePattern":"Only plain objects, and a few built-ins, can be passed to Client Components from Server Components\\. Classes or null prototypes are not supported\\.(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-server/src/ReactFlightServer.js","lineNumber":4149,"sourceCode":"      // We treat AsyncIterables as a Fragment and as such we might need to key them.\n      return renderAsyncFragment(request, task, value as any, getAsyncIterator);\n    }\n\n    // We put the Date check low b/c most of the time Date's will already have been serialized\n    // before we process it in this function but when rendering a Date() as a top level it can\n    // end up being a Date instance here. This is rare so we deprioritize it by putting it deep\n    // in this function\n    if (value instanceof Date) {\n      return serializeDate(value);\n    }\n\n    // Verify that this is a simple plain object.\n    const proto = getPrototypeOf(value);\n    if (\n      proto !== ObjectPrototype &&\n      (proto === null || getPrototypeOf(proto) !== null)\n    ) {\n      throw new Error(\n        'Only plain objects, and a few built-ins, can be passed to Client Components ' +\n          'from Server Components. Classes or null prototypes are not supported.' +\n          describeObjectForErrorMessage(parent, parentPropertyName),\n      );\n    }\n    if (__DEV__) {\n      if (objectName(value) !== 'Object') {\n        callWithDebugContextInDEV(request, task, () => {\n          console.error(\n            'Only plain objects can be passed to Client Components from Server Components. ' +\n              '%s objects are not supported.%s',\n            objectName(value),\n            describeObjectForErrorMessage(parent, parentPropertyName),\n          );\n        });\n      } else if (!isSimpleObject(value)) {\n        callWithDebugContextInDEV(request, task, () => {\n          console.error(","sourceCodeStart":4131,"sourceCodeEnd":4167,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-server/src/ReactFlightServer.js#L4131-L4167","documentation":"React Server Components can only send plain objects and a fixed set of built-ins (Date, Map, Set, Promise, TypedArrays, arrays, etc.) across the serialization boundary to Client Components. When the serializer meets a value whose prototype is neither Object.prototype nor a directly null-adjacent prototype — i.e. a class instance or a null-prototype object — it throws, because there is no defined wire format for arbitrary classes.","triggerScenarios":"Passing a class instance (new User(...), a Mongoose document, a Sequelize row, a moment object) as a prop to a 'use client' component; passing Object.create(null) values; ORM results whose rows are model instances spread straight into JSX.","commonSituations":"Data layers returning rich model objects; domain-entity classes used in server code; utility libraries returning null-prototype objects for safety; migrating a page to RSC while reusing existing prop shapes.","solutions":["Map class instances to plain object literals before crossing the boundary ({id: user.id, name: user.name}).","Call an explicit serialization helper (toJSON(), .lean() for Mongoose, raw query options) at the data layer.","Pass only the fields needed as props and keep rich objects server-side."],"exampleFix":"// before\n<ClientProfile user={userRecord} /> {/* userRecord = new User(...) */}\n\n// after\n<ClientProfile user={{id: userRecord.id, name: userRecord.name}} />","handlingStrategy":"type-guard","validationCode":"export function assertPlainProps(props: Record<string, unknown>) {\n  for (const [k, v] of Object.entries(props)) {\n    if (!isPlainObject(v) && !isKnownBuiltIn(v)) {\n      throw new Error(`prop ${k} of ${Object.prototype.toString.call(v)} is not RSC-serializable`);\n    }\n  }\n}\nfunction isKnownBuiltIn(v: unknown): boolean {\n  return v == null || ['string', 'number', 'boolean', 'bigint'].includes(typeof v)\n    || v instanceof Date || v instanceof Map || v instanceof Set || Array.isArray(v)\n    || ArrayBuffer.isView(v) || typeof v === 'symbol' || typeof v === 'function';\n}","typeGuard":"export function isPlainObject(v: unknown): v is Record<string, unknown> {\n  if (typeof v !== 'object' || v === null) return false;\n  return Object.getPrototypeOf(v) === Object.prototype;\n}","tryCatchPattern":null,"preventionTips":["Return POJOs from the data layer (raw queries, .lean(), toJSON()).","Keep a boundary function mapping domain objects to DTOs before JSX.","Run a DEV-time prop walker that reports the offending prop name."],"tags":["serialization","props","plain-objects","server-components"],"backgroundTag":"rsc-serialization","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}