# Next.js: You are attempting to export "metadata" from a component marked with "use client", which is disallowed

**Code:** `You are attempting to export "metadata" from a component marked with "use client"` · **Category:** Next.js · **Seen on:** Next.js, React

`metadata`/`generateMetadata` can only be exported from Server Components.

## Meaning

Remove `"use client"` from the page/layout that exports metadata, or move the interactive part into a separate Client Component and keep the page server-side. Metadata is evaluated on the server.

## Common causes

- `"use client"` at the top of `page.tsx` that exports metadata
- Layout marked client but exporting metadata
- Mixed server/client concerns in one file
- Copy of a client component turned into a page
- Re-export from a client module

## Quick fix

1. Make the page a Server Component and import a Client Component for interactivity
2. Keep `export const metadata = {...}` in the server file
3. Use `useEffect(() => { document.title = ... })` only for purely client pages

## Detailed fix by platform

### Next.js

1. 

```tsx
// page.tsx (server)
export const metadata = { title: "Home" };
export default function Page() { return <ClientPart />; }
```


## How to diagnose

1. **Directive** — "use client" on this file?
2. **Metadata** — Where exported?
3. **Split** — Server page + client child?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/nextjs/metadata-export-in-client-component)
