facebook/react · error

An error occurred in the <${componentName}> component. Cons

Error message

An error occurred in the <${componentName}> component.

Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://react.dev/link/error-boundaries to learn more about error boundaries.

What it means

Error "An error occurred in the <${componentName}> component. Consider adding an error boundary to your tree to customize error handling behavior. Visit https://react.dev/link/error-boundaries to learn more about error boundaries." thrown in facebook/react.

Source

Thrown at packages/react-reconciler/src/ReactFiberErrorLogger.js:48

): void {
  // Overriding this can silence these warnings e.g. for tests.
  // See https://github.com/facebook/react/pull/13384

  // For uncaught root errors we report them as uncaught to the browser's
  // onerror callback. This won't have component stacks and the error addendum.
  // So we add those into a separate console.warn.
  reportGlobalError(error);
  if (__DEV__) {
    const componentNameMessage = componentName
      ? `An error occurred in the <${componentName}> component.`
      : 'An error occurred in one of your React components.';

    const errorBoundaryMessage =
      'Consider adding an error boundary to your tree to customize error handling behavior.\n' +
      'Visit https://react.dev/link/error-boundaries to learn more about error boundaries.';

    try {
      console.warn(
        '%s\n\n%s\n',
        componentNameMessage,
        errorBoundaryMessage,
        // We let our console.error wrapper add the component stack to the end.
      );
    } finally {
      // ignore
    }
  }
}

export function defaultOnCaughtError(
  error: mixed,
  errorInfo: {
    +componentStack?: ?string,
    +errorBoundary?: ?component(...props: any),
  },
): void {

View on GitHub (pinned to eafeac097b)

When it happens

Trigger: Thrown at packages/react-reconciler/src/ReactFiberErrorLogger.js:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of facebook/react@eafeac097b (2026-08-21). Data as JSON: /api/errors/ba1f3918b07fbc40. Report an issue: GitHub.