nextjs - ✅(Solved) Fix Failed to execute 'measure' on 'Performance': '​NotFound' cannot have a negative time stamp. [3 pull requests, 12 comments, 9 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86060Fetched 2026-04-08 02:12:44
View on GitHub
Comments
12
Participants
9
Timeline
44
Reactions
30
Timeline (top)
subscribed ×22commented ×12cross-referenced ×3mentioned ×3

Error Message

The error shouldn't happen. The error has something to do with the CatchAllPage that shows the NotFound component. The error may show outside a not-found page, and it shows randomly (but frequently) during development when i'm making changes to the code. I didn't find anything related to cannot have a negative time stamp anywhere else.

Fix Action

Fixed

PR fix notes

PR #88688: fix: performance.measure negative timestamp error when notFound() is called

Description (problem / solution / changelog)

Fixes #86060

What?

This PR fixes the error Failed to execute 'measure' on 'Performance': '​SlugPage' cannot have a negative time stamp that occurs in development mode when notFound() is called in a dynamic route.

Why?

The error originates from React's performance tracking code in react-server-dom-turbopack-client.browser.development.js. When a component is rejected (e.g., when notFound() is called) or aborted, the code calls performance.measure() without validating that childrenEndTime is non-negative.

The childrenEndTime variable is initialized to -Infinity and only gets updated when children are processed. If no children have been processed yet (which can happen with notFound() calls that interrupt rendering), childrenEndTime remains -Infinity, causing performance.measure() to throw an error.

The normal (non-error) code path already has this check:

if (supportsUserTiming && 0 <= childrenEndTime$jscomp$2 && 10 > trackIdx$jscomp$2)

But the rejected/error and aborted code paths were missing the 0 <= childrenEndTime check:

if (supportsUserTiming) {  // Missing the childrenEndTime check

How?

Added the missing 0 <= childrenEndTime check to the two affected code paths:

  1. Rejected/Error case: When a component is rejected (e.g., notFound() is called)
  2. Aborted case: When a component is aborted before finishing rendering

The fix was applied to all four affected compiled React files:

  • react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js
  • react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js
  • react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js
  • react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js

Testing

Added a regression test at test/development/app-dir/not-found-performance-measure/ that verifies no "negative time stamp" errors appear in the browser console when:

  • notFound() is called in a dynamic route
  • HMR updates occur on not-found pages
  • Rapid navigation between pages triggers notFound()
  • Rapid HMR updates occur on not-found pages

Notes

This is a patch to React's compiled code bundled with Next.js. The upstream fix should be reported to React.

Changed files

  • packages/next/src/compiled/react-server-dom-turbopack-experimental/cjs/react-server-dom-turbopack-client.browser.development.js (modified, +2/-2)
  • packages/next/src/compiled/react-server-dom-turbopack/cjs/react-server-dom-turbopack-client.browser.development.js (modified, +2/-2)
  • packages/next/src/compiled/react-server-dom-webpack-experimental/cjs/react-server-dom-webpack-client.browser.development.js (modified, +2/-2)
  • packages/next/src/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-client.browser.development.js (modified, +2/-2)
  • test/development/app-dir/not-found-performance-measure/app/[slug]/not-found.tsx (added, +3/-0)
  • test/development/app-dir/not-found-performance-measure/app/[slug]/page.tsx (added, +18/-0)
  • test/development/app-dir/not-found-performance-measure/app/layout.tsx (added, +11/-0)
  • test/development/app-dir/not-found-performance-measure/app/not-found.tsx (added, +3/-0)
  • test/development/app-dir/not-found-performance-measure/app/page.tsx (added, +3/-0)
  • test/development/app-dir/not-found-performance-measure/next.config.js (added, +6/-0)
  • test/development/app-dir/not-found-performance-measure/not-found-performance-measure.test.ts (added, +185/-0)

PR #648: feat(otel): modernize OpenTelemetry tracing

Description (problem / solution / changelog)

Summary

This PR upgrades and hardens OpenTelemetry tracing across TripSage AI while preserving the Vercel-first server integration (@vercel/otel) and modernizing browser OTLP/HTTP tracing.

Key Changes

  • Dependencies

  • Client tracing modernization

    • Uses WebTracerProvider({ spanProcessors: [...] }) and BatchSpanProcessor (no unsafe casts).
    • OTLP URL normalization is canonical: ensures exporter URL ends with /v1/traces (no trailing slash; strips query/hash).
    • Prevents self-instrumentation loops by ignoring exporter traffic in FetchInstrumentation.ignoreUrls.
    • Restricts traceparent propagation to same-origin fetches.
    • Uses semconvStabilityOptIn: "http/dup" for safer HTTP semconv migration.
    • Loads zone.js + ZoneContextManager only when browser telemetry is enabled.
  • Performance / instrumentation safety

    • Defensive patch to avoid performance.measure() negative timestamp errors.
  • UI / accessibility fixes

    • Form labeling and control wiring improvements on Trips pages.
    • Error boundary “Go to Login” navigation uses next/link (no window.location imperative navigation).
  • Docs / ADR alignment

    • Updated observability docs and accepted ADR-0046; clarified config examples including .../v1/traces/.

External Review Feedback Addressed

  • P1 (OTLP normalization): .../v1/traces/ now normalizes to .../v1/traces.
  • P2 (Zone import gating): zone.js is not imported/patched when NEXT_PUBLIC_OTEL_EXPORTER_OTLP_ENDPOINT is unset/empty.

Commit Breakdown

  • chore(otel): bump opentelemetry packages
  • feat(telemetry): modernize client tracing init
  • test(telemetry): cover otlp normalization and zone gating
  • fix(a11y): improve form labeling and navigation
  • docs(otel): align observability docs and ADRs

Verification

  • Quality gates:
    • pnpm biome:fix
    • pnpm type-check
    • pnpm test:affected
  • Browser validation (agent-browser):
    • Verified no runtime errors with telemetry disabled (endpoint unset)
    • Verified no runtime errors with NEXT_PUBLIC_OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318/v1/traces/

Changed files

  • README.md (modified, +24/-0)
  • docs/SESSION_PROTOCOL.md (removed, +0/-39)
  • docs/agents/00-readme.md (removed, +0/-23)
  • docs/agents/01-runtime-and-routing.md (removed, +0/-32)
  • docs/agents/02-supabase-auth-rls.md (removed, +0/-31)
  • docs/agents/03-ui-ux-theming.md (removed, +0/-32)
  • docs/agents/04-playwright-e2e.md (removed, +0/-48)
  • docs/agents/05-ai-sdk-wiring.md (removed, +0/-30)
  • docs/agents/06-deployment-perf-cost.md (removed, +0/-29)
  • docs/api/agents.md (modified, +8/-8)
  • docs/api/auth.md (modified, +1/-1)
  • docs/api/calendar.md (modified, +9/-9)
  • docs/api/chat.md (modified, +7/-7)
  • docs/api/index.md (modified, +5/-5)
  • docs/api/internal/config.md (modified, +7/-7)
  • docs/api/internal/index.md (modified, +1/-1)
  • docs/api/internal/webhooks.md (modified, +9/-10)
  • docs/api/keys.md (modified, +3/-3)
  • docs/api/memory.md (modified, +8/-8)
  • docs/api/places.md (modified, +10/-10)
  • docs/api/security.md (modified, +6/-6)
  • docs/api/trips.md (modified, +1/-1)
  • docs/architecture/decisions/README.md (modified, +1/-1)
  • docs/architecture/decisions/adr-0046-otel-tracing-frontend.md (modified, +38/-21)
  • docs/architecture/frontend-architecture.md (modified, +6/-0)
  • docs/development/ai/observability.md (added, +34/-0)
  • docs/development/architecture/layering.md (modified, +4/-0)
  • docs/development/backend/observability.md (modified, +16/-4)
  • docs/development/dependencies-deprecations.md (removed, +0/-90)
  • docs/development/frontend/forms.md (modified, +4/-2)
  • docs/development/frontend/loading-components.md (modified, +2/-2)
  • docs/development/standards/standards.md (modified, +8/-0)
  • docs/development/testing/coverage-milestones.md (modified, +7/-2)
  • docs/release/00-release-goals.md (removed, +0/-46)
  • docs/release/01-current-state-audit.md (removed, +0/-573)
  • docs/release/02-gap-analysis.md (removed, +0/-39)
  • docs/release/03-execution-plan.md (removed, +0/-86)
  • docs/release/04-test-plan.md (removed, +0/-49)
  • docs/release/05-security-and-privacy.md (removed, +0/-86)
  • docs/release/06-perf-and-cost.md (removed, +0/-29)
  • docs/release/07-deployment.md (removed, +0/-88)
  • docs/release/08-release-notes.md (removed, +0/-24)
  • docs/release/_logs/README.md (removed, +0/-6)
  • docs/release/_logs/git-status.txt (removed, +0/-6)
  • docs/release/_logs/nextjs-dev-tail.txt (removed, +0/-12)
  • docs/release/_logs/nextjs-routes.json (removed, +0/-122)
  • docs/release/_logs/node-version.txt (removed, +0/-1)
  • docs/release/_logs/package-version.txt (removed, +0/-1)
  • docs/release/_logs/pnpm-ai-tools-check.txt (removed, +0/-17)
  • docs/release/_logs/pnpm-biome-check.txt (removed, +0/-5)
  • docs/release/_logs/pnpm-boundary-check.txt (removed, +0/-17)
  • docs/release/_logs/pnpm-build.txt (removed, +0/-141)
  • docs/release/_logs/pnpm-check-no-secrets.txt (removed, +0/-5)
  • docs/release/_logs/pnpm-install.txt (removed, +0/-10)
  • docs/release/_logs/pnpm-lint.txt (removed, +0/-3)
  • docs/release/_logs/pnpm-test-e2e.txt (removed, +0/-903)
  • docs/release/_logs/pnpm-test.txt (removed, +0/-230)
  • docs/release/_logs/pnpm-type-check.txt (removed, +0/-4)
  • docs/release/_logs/pnpm-version.txt (removed, +0/-1)
  • docs/release/_logs/python-version-python.txt (removed, +0/-2)
  • docs/release/_logs/python-version.txt (removed, +0/-1)
  • docs/release/_logs/server-actions.use-server.txt (removed, +0/-7)
  • docs/release/_logs/static-scan.todo.txt (removed, +0/-212)
  • docs/release/_logs/uv-version.txt (removed, +0/-1)
  • e2e/dashboard-functionality.spec.ts (modified, +16/-16)
  • e2e/error-boundaries-loading.spec.ts (modified, +2/-2)
  • package.json (modified, +8/-6)
  • pnpm-lock.yaml (modified, +117/-83)
  • src/app/(app)/chat/chat-client.tsx (modified, +5/-5)
  • src/app/(app)/chat/layout.tsx (modified, +6/-1)
  • src/app/(app)/dashboard/agent-status/page.tsx (modified, +2/-2)
  • src/app/(app)/dashboard/demo/realtime/page.tsx (modified, +12/-12)
  • src/app/(app)/dashboard/page.tsx (modified, +1/-1)
  • src/app/(app)/dashboard/search/activities/activities-search-client.tsx (modified, +26/-11)
  • src/app/(app)/dashboard/search/destinations/destination-comparison-modal.tsx (modified, +17/-5)
  • src/app/(app)/dashboard/search/destinations/destinations-search-client.tsx (modified, +10/-7)
  • src/app/(app)/dashboard/search/flights/results/page.tsx (modified, +8/-5)
  • src/app/(app)/dashboard/search/hotels/hotels-empty-state.tsx (modified, +1/-1)
  • src/app/(app)/dashboard/search/hotels/hotels-search-client.tsx (modified, +11/-8)
  • src/app/(app)/dashboard/search/search-hub-client.tsx (modified, +56/-44)
  • src/app/(app)/dashboard/search/unified/unified-search-client.tsx (modified, +16/-21)
  • src/app/(app)/dashboard/settings/page.tsx (modified, +5/-3)
  • src/app/(app)/dashboard/trips/create/page.tsx (modified, +36/-21)
  • src/app/(app)/dashboard/trips/trips-client.tsx (modified, +37/-12)
  • src/app/(auth)/layout.tsx (modified, +7/-1)
  • src/app/(auth)/login/page.tsx (modified, +3/-3)
  • src/app/(auth)/register/page.tsx (modified, +3/-3)
  • src/app/(auth)/reset-password/page.tsx (modified, +2/-2)
  • src/app/(marketing)/ai-demo/page.tsx (modified, +3/-2)
  • src/app/(marketing)/contact/page.tsx (modified, +2/-1)
  • src/app/(marketing)/page.tsx (modified, +3/-2)
  • src/app/(marketing)/privacy/page.tsx (modified, +2/-1)
  • src/app/(marketing)/terms/page.tsx (modified, +2/-1)
  • src/app/__tests__/error-boundaries-integration.test.tsx (modified, +9/-0)
  • src/app/__tests__/root-loading.test.tsx (added, +18/-0)
  • src/app/error.tsx (modified, +6/-1)
  • src/app/globals.css (modified, +94/-0)
  • src/app/layout.tsx (modified, +7/-2)
  • src/app/loading.tsx (modified, +6/-1)
  • src/components/admin/configuration-manager.tsx (modified, +24/-12)

PR #5: fix(auth): move role-based routing to middleware

Description (problem / solution / changelog)

Summary

  • Move role-based routing (scout→/dashboard, academy_admin→/admin, platform_admin→/platform) from layout redirect() calls to middleware
  • Replace layout redirect() with notFound() as defense-in-depth guards
  • Eliminates React 19 Turbopack dev-mode TypeError: 'DashboardLayout' cannot have a negative time stamp (vercel/next.js#86060)

Changes

  • src/middleware.ts — Added role-based routing after getUser() with ROLE_HOME and PATH_ALLOWED_ROLES maps. Preserves refreshed auth cookies on redirect responses. Fail-open on profile query errors.
  • src/app/dashboard/layout.tsxredirect()notFound() defense-in-depth
  • src/app/admin/layout.tsxredirect()notFound() defense-in-depth
  • src/app/platform/layout.tsxredirect()notFound() defense-in-depth
  • docs/solutions/ — Root cause analysis and prevention rules

Testing

  • npm run build passes with no type errors
  • All role routing paths verified against acceptance criteria
  • Auth callback flow unaffected
  • Production behavior unchanged (bug was dev-mode only)

Post-Deploy Monitoring & Validation

No additional operational monitoring required: This fix changes middleware redirect behavior (dev-mode only bug). Production redirect() calls never triggered the error. The middleware routing produces identical HTTP redirects to the previous layout redirects.


Compound Engineered 🤖 Generated with Claude Code

Changed files

  • docs/plans/2026-03-02-fix-dashboard-layout-negative-timestamp-plan.md (added, +25/-0)
  • docs/solutions/runtime-errors/turbopack-performance-instrumentation-redirect-bug.md (added, +154/-0)
  • src/app/admin/layout.tsx (modified, +6/-13)
  • src/app/dashboard/layout.tsx (modified, +6/-11)
  • src/app/platform/layout.tsx (modified, +6/-9)
  • src/middleware.ts (modified, +44/-1)

Code Example

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 15893
  Available CPU cores: 16
Binaries:
  Node: 22.18.0
  npm: 11.6.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.0.2-canary.16 // Latest available version is detected (16.0.2-canary.16).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/MOSAIC-ETC/website

To Reproduce

  1. Start the application in development mode (next dev)
  2. Go to a non-existing page (/404, for example)
  3. Make a change in the code of [locale]/not-found.tsx (change the text)
  4. Update the page some times
  5. If it doesn't work, go back to step two, after some time (not very long, but it is somewhat random), it should appear

Current vs. Expected behavior

The error shouldn't happen.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP Tue Nov 5 00:21:55 UTC 2024
  Available memory (MB): 15893
  Available CPU cores: 16
Binaries:
  Node: 22.18.0
  npm: 11.6.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.0.2-canary.16 // Latest available version is detected (16.0.2-canary.16).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

I'm using WSL.

The error has something to do with the CatchAllPage that shows the NotFound component. The error may show outside a not-found page, and it shows randomly (but frequently) during development when i'm making changes to the code. I didn't find anything related to cannot have a negative time stamp anywhere else.

<img width="1024" height="458" alt="Image" src="https://github.com/user-attachments/assets/a90acb93-deac-4fc2-b8e6-02c8ae786bf8" />

extent analysis

TL;DR

  • The issue may be related to a caching or rendering problem in Next.js, and a potential fix could involve adjusting the next dev configuration or the CatchAllPage component.

Guidance

  • Verify if the issue persists when using a different development server or environment to isolate the problem.
  • Check the CatchAllPage component and the NotFound component for any potential caching or rendering issues, and consider adding logging or debugging statements to understand the component lifecycle.
  • Review the Next.js configuration and version to ensure it is compatible with the project's dependencies and setup.
  • Consider testing the application in a different environment, such as a native Linux setup, to see if the issue is specific to WSL.

Example

  • No specific code example can be provided without more information about the CatchAllPage and NotFound components.

Notes

  • The issue seems to be related to the development mode and the next dev command, and may be specific to the WSL environment.
  • The error message "cannot have a negative time stamp" is not clearly related to the provided code or configuration, and may require additional debugging or logging to understand.

Recommendation

  • Apply workaround: Try adjusting the next dev configuration or the CatchAllPage component to see if it resolves the issue, as the problem seems to be related to the development mode and rendering.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING