Error: 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.
Next.js · updated 2026-11-04
Thrown by React when it renders <Something /> and Something is not a component: undefined, an object (a module namespace) or another value. React adds "Check the render method of `Parent`" with the component that rendered it. In production it's Minified React error #130.
Error: 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 `OrderPage`.
Quick fix
Go to the component named in "Check the render method of" and look at each JSX tag's import. Match the import to the export: export default function Card → import Card from './card'; export function Card → import { Card } from './card'. For a library, check that the component exists under that name and path in the installed version.
- Open the parent component named in "Check the render method of …".
- For each custom tag in it, compare the import line with how that file exports the component (default or named).
- Fix the import, or add the missing export.
- For library components, check the installed version exports that name (an upgrade may have renamed or moved it).
- If it is undefined only sometimes, look for a circular import between the two files.
// components/order-card.tsx
export function OrderCard() { /* ... */ } // named export
// app/orders/page.tsx
// import OrderCard from '@/components/order-card'; // default import: undefined
import { OrderCard } from '@/components/order-card'; // matches the named export
export default function OrderPage() {
return <OrderCard />;
}Why it happens
Default vs named import
import X from when the file uses export function X (or the reverse) gives undefined; the most common cause by far.
The component is not exported
The function exists in the file but has no export, or was renamed in the file and not in the import.
A library changed its exports
After an upgrade, a component moved to another path or became a named export (icon packs and UI kits do this often).
got: object
A namespace import (import * as Card) or a CommonJS module rendered as a component gives "but got: object" instead of undefined.
Other fixes
- In production, Minified React error #130 links to react.dev/errors/130 with the same got: value.
- TypeScript reports the bad import at build time ("has no default export") if the file is type-checked, so this mostly slips through in JavaScript files or with any.
Same error, other wording
- Error: Minified React error #130; visit https://react.dev/errors/130?args[]=undefined&args[]= for the full message
- Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
- Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
Let your coding agent catch the next one
Runheed records this error in production with the stack trace, the breadcrumbs before it and the agent session that shipped the code, and serves it to Claude Code, Cursor or any MCP client. With it connected, you can ask:
> Find the "Element type is invalid" (Minified React error #130) errors, open the component named in "Check the render method of", and fix the import that resolves to undefined so it matches how the component is exported.
Related errors
- Objects are not valid as a React child (found: object with keys {id, name, total}). If...
- TypeError: Client is not a constructor
- Module not found: Can't resolve '@/components/OrderTable'
More in React and Next.js rendering
- Hydration failed because the server rendered HTML didn't match the client. As a result...Next.js
- An error occurred in the Server Components render. The specific message is omitted in...Next.js
- Dynamic server usage: Route /x couldn't be rendered statically because it used `headers`.Next.js
- ReferenceError: window is not definedNext.js
- Error: Event handlers cannot be passed to Client Component props.Next.js
- Only plain objects, and a few built-ins, can be passed to Client Components from Server...Next.js
- Route "/orders/[id]" used `params.id`. `params` should be awaited before using its...Next.js
- Error: NEXT_REDIRECTNext.js
- Error: NextRouter was not mounted.Next.js
- Invalid src prop (https://cdn.example.com/p/42.jpg) on `next/image`, hostname...Next.js
- TypeError: Failed to parse URL from /api/ordersNext.js
- Too many re-renders. React limits the number of renders to prevent an infinite loop.Next.js
- useSearchParams() should be wrapped in a suspense boundary at page "/search".Next.js
- You're importing a module that depends on `useState` into a React Server Component...Next.js
References: React docs: error #130, React docs: importing and exporting components