-
Notifications
You must be signed in to change notification settings - Fork 30.7k
Open
Labels
InstrumentationRelated to Next.js Instrumentation.Related to Next.js Instrumentation.MetadataRelated to Next.js' Metadata API.Related to Next.js' Metadata API.TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.
Description
Link to the code that reproduces this issue
https://github.com/reinaldosimoes/nextjs-resolvemetadata-root-span-repro
To Reproduce
- Clone the reproduction repo.
- Run
npm install. - Run
npm run dev. - Open
http://localhost:3000/static-fetchas the first request after a fresh restart. - Observe this warning in the terminal:
Unexpected root span type 'ResolveMetadata.generateMetadata'. Please report this Next.js issue https://github.com/vercel/next.js
Notes:
- This repro is minimal and uses
@sentry/nextjsinstrumentation plus a page whosegenerateMetadata()performs a normalfetch(...). - If I warm the app by hitting another route first and then visit
/static-fetch, the warning does not appear. - The second request to
/static-fetchalso does not warn.
Current vs. Expected behavior
Current behavior:
- In
next dev --turbopack, the first cold request to/static-fetchlogs:
Unexpected root span type 'ResolveMetadata.generateMetadata'. Please report this Next.js issue https://github.com/vercel/next.js
GET /static-fetch 200 in 590ms (next.js: 133ms, application-code: 457ms)
- The page still returns
200.
Expected behavior:
- A normal
generateMetadata()code path should not produce a warning about an unexpected root span type. ResolveMetadata.generateMetadataappears to be a valid documented Next.js OTEL span type, so it seems like the root-span detection/context handling is incorrect in this cold-start path.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:54:46 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 25.5.0
npm: 11.8.0
Yarn: 1.22.19
pnpm: 10.28.2
Relevant Packages:
next: 16.2.1-canary.5 // Latest available version is detected (16.2.1-canary.5).
eslint-config-next: N/A
react: 19.2.4
react-dom: 19.2.4
typescript: 5.9.3
Next.js Config:
output: N/AAlso reproduced on stable next@16.2.1.
Which area(s) are affected? (Select all that apply)
- Instrumentation
- Metadata
- Turbopack
Which stage(s) are affected? (Select all that apply)
- next dev (local)
Additional context
- The public repro also reproduces on
next@16.2.1-canary.5, not just stable16.2.1. - I first saw this in a real app on
next@16.2.0, then confirmed it still happened after upgrading to16.2.1. - In the real app, the warning appeared on a localized weather page whose
generateMetadata()did async work withfetch(...). - I narrowed the public repro down to the smallest case I could find:
- App Router page
generateMetadata()does a normalawait fetch("https://example.com")@sentry/nextjsinstrumentation activenext dev --turbopack- first request after restart
- I also checked
@sentry/nextjs@10.45.0; the warning still reproduces there. - It did not reproduce in my reduced repro when the metadata fetch used
cache: "no-store". - This may be related to the recent OTEL parent/root-span work in:
- Next.js OTEL docs list
ResolveMetadata.generateMetadataas a valid span type:
https://nextjs.org/docs/14/app/building-your-application/optimizing/open-telemetry
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
InstrumentationRelated to Next.js Instrumentation.Related to Next.js Instrumentation.MetadataRelated to Next.js' Metadata API.Related to Next.js' Metadata API.TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.