When trying to compose or edit a post, a page or any other custom post types such as portfolio, WooCommerce item, form, FAQ, announcement, event and more in Gutenberg editor, the following error may occurs:

The editor has encountered an unexpected error

Three options are available – Attempt Recovery, Copy Post Text and Copy Error, but none resolves the issue nor giving any useful information about why the problem happened.

The Editor Has Encountered an Unexpected Error

There may be many reasons why the error happened, such as conflict with other plugins or themes. However, if you have not installed new plugin or theme when the error arose, chance is that the error happened due to out-of-date stale cache that has expired.

The situation can happen when WordPress, plugins, themes or even some logics and algorithms are updated to newer version, but the old version of the files are still been cached and used by the web browser, caching plugin, proxy server, caching from web hosting company or CDN such as CloudFlare.

Thus the easiest way to resolve the error, try to force refresh the cache of the web browser (Pressing Ctrl + F5 in Windows; Apple + R or Command + R in macOS; F5 in Linux).

If above step is not enough, you need to delete and clear all the Cache and Offline Website Data or Hosted App Data (and possible Cookies and other site data) in web browser by clearing browsing history or browsing data. What you need to remove is just cached images and files, or just cache from all time, but not cookies which will also terminate all your login sessions.

If deleting web browser cache does not fix the WordPress editor’s problem, you can try to do the following to remove and delete all possible cache of the WordPress files:

  1. Purge the cache from any WordPress caching and optimization plugins (though most won’t cache WordPress backend editor).
  2. Purge the cache from proxy server or reverse proxy or web accelerators such as Varnish, if any.
  3. Purge the cache from CDN such as Cloudflare.
  4. Purge the cache from caching service provided by web hosting companies, if any.

The unexpected error for WordPress editor appears to affect only Gutenberg blocks editor. If you can live without it, you can switch back to Classic Editor, which will ensure that the error will not happen at all.