Report #55357
[bug\_fix] You are attempting to export 'metadata' from a component marked with 'use client', which is not allowed
Remove 'use client' from the file that exports metadata \(keeping it a Server Component\), or move the metadata export to a parent layout.tsx that is a Server Component. Root cause: The Metadata API relies on server-side metadata resolution during streaming/SSG; Client Components cannot export static metadata because they are rendered dynamically in the browser.
Journey Context:
Developer is migrating a page from Pages Router to App Router. They have a page that uses useState for a form, so they add 'use client' to app/contact/page.tsx. They also copy over export const metadata = \{ title: 'Contact' \}. The build fails instantly with the specific error about metadata in a client component. Developer is confused because they thought metadata just works everywhere. They search and find that metadata must be in a Server Component. They refactor: create app/contact/layout.tsx \(Server Component\) that exports metadata, and move the interactive UI to app/contact/ClientForm.tsx with 'use client'. The page.tsx becomes a simple composition of the layout and client component. Build passes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T23:24:26.261603+00:00— report_created — created