nextjs - 💡(How to fix) Fix Runtime error: "Element type is invalid" for React 19.2 Activities [9 comments, 5 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#84489Fetched 2026-04-08 02:19:08
View on GitHub
Comments
9
Participants
5
Timeline
22
Reactions
0
Timeline (top)
commented ×9subscribed ×5issue_type_added ×2labeled ×2

Error Message

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of Home.

Next.js version: 15.5.4 (Turbopack)

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:51 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.13.1
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 10.16.0
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  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/AdrianAndersen/next-react-activity-bug

To Reproduce

The provided repository is created using pdx create-next-app@latest with defaults.

I then upgraded to react and react-dom 19.2.0 and added an Activity

A runtime error is thrown when you visit http://localhost:3000/ in dev mode, or when you try to run a production build.

Current vs. Expected behavior

A runtime error is thrown when a React Activity is present in the rendered code

Error Type

Runtime Error

Error Message

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Check the render method of Home.

Next.js version: 15.5.4 (Turbopack)

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.0.0: Mon Aug 25 21:17:51 PDT 2025; root:xnu-12377.1.9~3/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 8
Binaries:
  Node: 22.13.1
  npm: 10.9.2
  Yarn: 1.22.22
  pnpm: 10.16.0
Relevant Packages:
  next: 15.5.4 // Latest available version is detected (15.5.4).
  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)

React

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

next build (local)

Additional context

I also tested on 15.6.0-canary.41 (as of writing the latest canary), and the error is present there too.

I tested React Activities in a TanStack Router project, and since it worked there I assume this is related to something in Next.js. Please correct me if this should be submitted somewhere else.

extent analysis

TL;DR

  • The issue is likely related to compatibility between Next.js and React 19.2.0, specifically with React Activities, and may require a workaround or update to a future version of Next.js.

Guidance

  • Verify that the issue persists when creating a new Next.js project with the same versions of React and React DOM to isolate the problem.
  • Check the official Next.js and React documentation for any known issues or compatibility notes regarding React Activities.
  • Consider testing with an earlier version of React to see if the issue is specific to version 19.2.0.
  • Review the code changes made when introducing React Activities, specifically the commit mentioned, to ensure that all components are properly exported and imported.

Example

  • No specific code example can be provided without more details on the implementation of React Activities in the project.

Notes

  • The issue seems to be specific to Next.js, as the same functionality works in a TanStack Router project.
  • The problem persists across different versions of Next.js, including the latest canary version, suggesting a deeper compatibility issue.

Recommendation

  • Apply workaround: Given the persistence of the issue across different Next.js versions, a workaround may be necessary until an official fix is released, such as modifying the component export/import structure or using an alternative approach to React Activities if possible.

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