Requires understanding of opentelemetry span lifecycle in Next.js
The issue involves opentelemetry warnings appearing when spans are accessed after closure, likely related to recent changes in v16.2.0. Needs investigation into span lifecycle management during server operations. Blockers include needing opentelemetry expertise and understanding Next.js instrumentation changes.
https://github.com/tmair/otel-issue
pnpm installpnpm run starthttp://localhost:3000/I expect no warnings from opentelemetry in the console but I get the following warning on each request:
Cannot execute the operation on ended Span {traceId: 722ebe96aae7b52fa0afa2f06a5110c0, spanId: 4663e719a6a39b15} Error: Operation attempted on ended Span {traceId: 722ebe96aae7b52fa0afa2f06a5110c0, spanId: 4663e719a6a39b15}
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:51:28 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6041
Available memory (MB): 49152
Available CPU cores: 16
Binaries:
Node: 24.11.0
npm: 11.6.1
Yarn: 1.22.22
pnpm: 10.20.0
Relevant Packages:
next: 16.2.0 // Latest available version is detected (16.2.0).
eslint-config-next: N/A
react: 19.2.4
react-dom: 19.2.4
typescript: 5.9.3
Next.js Config:
output: N/A
Not sure
next start (local)
This happens when using a custom server and opentelemetry instrumentation. It seems that the parent span is already closed when trying to add additional attributes onto it.
I suspect that the changes made in #90832 cause this issue. Downgrading to v16.1.7 fixes the issue.
Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!