How To Recover From An Error Caused By Plugin

I could neither open nor edit a post in WordPress. The error “Uncaught (in promise) TypeError: Cannot read property ‘replace’ of undefined” occurred.

Problem

I created a post with “Enlighter Sourcecode” block by using Enlighter plugin and save the post. When I opened the saved post, the error “Uncaught (in promise) TypeError: Cannot read property ‘replace’ of undefined” occurred and nothing was displayed.

Environment

WordPress 5.5.3
Enlighter – Customizable Syntax Highlighter 4.4.1

The cause of this problem

Reference: Unable to edit posts when EnlighterJs is enabled

The block is somehow corrupted.

Solution

1. Deactivate the plugin at issue.

2. Open the post in edit mode and copy all contents.

3. Activate the plugin again. And create new post and paste it.