React: Cannot read property '__reactInternalInstance$liajyozl96m' of null

Created on 16 Nov 2017  路  5Comments  路  Source: facebook/react

Super unhelpful error from React, can this be improved? i.e hierarchy trace any kind of pointer

/User/chewbacca/app/node_modules/react-dom/lib/ReactDOMComponentTree.js:113 Uncaught TypeError: Cannot read property '__reactInternalInstance$liajyozl96m' of null
    at Object.getClosestInstanceFromNode (/User/chewbacca/app/node_modules/react-dom/lib/ReactDOMComponentTree.js:113)
    at findParent (/User/chewbacca/app/node_modules/react-dom/lib/ReactEventListener.js:38)
    at handleTopLevelImpl (/User/chewbacca/app/node_modules/react-dom/lib/ReactEventListener.js:67)
    at ReactDefaultBatchingStrategyTransaction.perform (/User/chewbacca/app/node_modules/react-dom/lib/Transaction.js:143)
    at Object.batchedUpdates (/User/chewbacca/app/node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js:62)
    at Object.batchedUpdates (/User/chewbacca/app/node_modules/react-dom/lib/ReactUpdates.js:97)
    at dispatchEvent (/User/chewbacca/app/node_modules/react-dom/lib/ReactEventListener.js:147)

Most helpful comment

If you enable "break on all exceptions" in Chrome debugger it should stop at the original error in your code. This can let you trace where the error actually happens and which catch block accidentally swallows it.

All 5 comments

You should wrap your top-most component using ErrorBoundary. Using ErrorBoundary will remove such cryptic errors. It will print the beautiful error message in your browser console which you can easily debug. You can read more about error-boundaries on official react website.
https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html.

Oh thanks, I didn't realize there was such a thing already!

This specific cryptic error is either a bug in React 15 or a consequence of a real error in your app that your app swallowed in a catch block. In either case upgrading to React 16 should solve the issue. :-)

@gaearon this is true, it's React 15 still and there was an error in my code, but since the message was cryptic it was hard to understand where it comes from. Thanks for all suggestions!

If you enable "break on all exceptions" in Chrome debugger it should stop at the original error in your code. This can let you trace where the error actually happens and which catch block accidentally swallows it.

Was this page helpful?
0 / 5 - 0 ratings