Next.js · build error
export "metadata" from a "use client" page
Error: You are attempting to export "metadata" from a component marked with "use client", which is disallowed. "metadata" must be resolved on the server before the page component is rendered. Keep your page as a Server Component and move Client Component logic to a separate file.What it means
metadata and generateMetadata only work in Server Components. Once a page has "use client" at the top, it can't export them.
Common causes
- The page was turned into a Client Component to fix a hook error
- An agent added SEO metadata to an existing client page
How to fix it
- Remove "use client" from page.tsx so it can export metadata
- Move the interactive part into a separate "use client" component and render it from the page
Prompt for Cursor or Claude Code
Next.js refuses to export metadata from a "use client" page. Split it: keep page.tsx as a Server Component that exports metadata, and move the interactive code into a new client component file it renders.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 setup. The VibeBoot SaaS Starter gives you auth, Stripe and a database already wired on Next.js 16.4.3, with AGENTS.md and .cursor/rules that keep your agent on the Next.js 16 conventions. $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.