Next.js: only plain objects can be passed to Client Components
Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.Short answer
Props from a Server Component to a Client Component must be serializable. Class instances, objects with a null prototype, and plain functions are not. Convert the value to a plain object before passing it, or call the function inside the Client Component. Database rows and SDK responses are the usual culprits.
Fix it fast
1Find out which cause you have
Find the Server Component that renders the Client Component and log what you pass. Note whether the value is a class instance, comes from an ORM, or has a null prototype.
console.log(Object.getPrototypeOf(value), value?.constructor?.name)2Match what you see, then jump to its fix
- 1
The error names the prop, and the value comes from a database or API clientA class instance (ORM model, SDK result) is passed as a propFix - 2
Value came from Object.create(null) or a library that builds objects that way (query strings, some parsers)The object was created with a null prototypeFix - 3
The prop is a callback or a helper defined in the Server ComponentA function that is not a Server Function is passed as a propFix
- 1
What does the error look like?
Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.
Cause 1 of 3
A class instance (ORM model, SDK result) is passed as a prop
1Check
Per React, objects that are instances of any class other than the built-ins are not supported. Inspect the constructor name.
console.log(value?.constructor?.name) // anything except Object or a built-in is a problem2Fix
Copy it into a plain object, keeping only the fields the Client Component needs.
// Server Component
const user = await db.user.findUnique({ where: { id } })
const plain = { id: user.id, name: user.name, createdAt: user.createdAt }
return <Profile user={plain} />3Verify
Reload the page; the error should be gone.
npm run devConfirmed by react.dev
Cause 2 of 3
The object was created with a null prototype
1Check
Check the prototype of the value.
console.log(Object.getPrototypeOf(value) === null)2Fix
Spread it into a normal object literal.
const plain = { ...value }3Verify
Render the Client Component again.
npm run devConfirmed by react.dev
Cause 3 of 3
A function that is not a Server Function is passed as a prop
1Check
Functions can cross the boundary only if they are Server Functions or exported from a client-marked module.
grep -rn "use server\|use client" app | head2Fix
Define the handler inside the Client Component, or make a Server Function with 'use server'.
// actions.ts
'use server'
export async function save(formData: FormData) { /* ... */ }3Verify
Pass the action as a prop and run it from the client.
npm run devConfirmed by react.dev
How do I stop it coming back?
- Map database and SDK results to plain objects at the data layer before they reach components.
- Pass only the fields the Client Component displays.
- Add the 'server-only' package to data modules so they are never imported by client code.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
Next.js: Event handlers cannot be passed to Client Component props
onClick in a Server Component, or a callback prop sent to a Client Component
In the App Router, pages and layouts are Server Components, and a function cannot be sent from the server to the browser as a prop.
3 causes, each with a fixWeb apps
ESLint says an element in a list is missing its key prop
react/jsx-key
react/jsx-key fires when an element returned from map, Array.from or an array literal has no key.
3 causes, each with a fixWeb apps
There is no tailwind.config.js after installing Tailwind 4 and HeroUI in Next.js
HeroUI components render unstyled
Nothing is broken: Tailwind CSS 4 is configured in CSS and no longer creates tailwind.config.js.
3 causes, each with a fixWeb apps
react-i18next shows the wrong plural form for a count, or prints the key instead of the text
t('item') prints the key item instead of a translated sentence
i18next picks a plural from the count option and looks for keys ending in _one, _other and so on.
4 causes, each with a fixWeb apps
useSession throws because there is no SessionProvider above it
[next-auth]: `useSession` must be wrapped in a <SessionProvider />
useSession reads the session from React Context, and SessionProvider is what creates that context.
3 causes, each with a fixWeb apps
next/link throws React.Children.only on its children
Error: React.Children.only expected to receive a single React element child.
React.Children.only accepts exactly one React element and throws for anything else, including an array with one item.
3 causes, each with a fix