Next.js · next build (prerender)
Event handlers cannot be passed to Client Component props
Error occurred prerendering page "/pricing".
Error: Event handlers cannot be passed to Client Component props.
{onClick: function onClick, children: ...}
^^^^^^^^^^^^^^^^
If you need interactivity, consider converting part of this to a Client Component.What it means
A Server Component rendered an element with onClick, onChange or any prop starting with "on" set to a function. Functions can't be sent from the server to the browser, so rendering stops.
Common causes
- onClick added to a <button> directly in page.tsx
- A Server Component passes onSomething={() => …} to a Client Component
- It often only shows up at next build, when the page is prerendered
How to fix it
- Move the button (and its handler) into a "use client" component
- Or keep it on the server: use a <form action={serverAction}> instead of onClick
- If the child is already a Client Component, define the handler inside it instead of passing it down
Prompt for Cursor or Claude Code
next build fails with "Event handlers cannot be passed to Client Component props". Find the Server Component that sets an on* prop to a function, and either move that element into a "use client" component or replace the handler with a Server Action used as a form action. Show me the diff.Not quite your error? Paste yours into the free VibeBoot Doctor or browse the Next.js error fixer.
next: skip the next one
Skip the debugging. The VibeBoot SaaS Starter ships with this already handled: it follows the Next.js 16 conventions (src/proxy.ts, Server Components by default, request-time data in <Suspense>) and its AGENTS.md and .cursor/rules keep your agent on them. Plus auth, Stripe and a database on Next.js 16.4.3. $49, one-time.
14-day money-back guarantee · lifetime updates
Other Next.js errors
$ fixed it? get the next one first
New fixes for what AI agents break, by email.
When we add a fix or a Cursor rule for a new Next.js, Auth.js, Prisma or Stripe break, it goes out in the VibeBoot newsletter. Free, occasional, unsubscribe in one click.