```
/w/index.php?title=Q4060911&action=edit&undoafter=211322910&undo=212116913 Diff\Patcher\PatcherException from line 586 of /srv/mediawiki/php-1.26wmf2/extensions/Wikidata/extensions/Wikibase/repo/includes/content/EntityContent.php: EntityContent must not contain Entity data as well as a redirect after applying the patch!
#0 /srv/mediawiki/php-1.26wmf2/extensions/Wikidata/extensions/Wikibase/repo/includes/actions/EditEntityAction.php(314): Wikibase\EntityContent->getPatchedCopy()
#1 /srv/mediawiki/php-1.26wmf2/extensions/Wikidata/extensions/Wikibase/repo/includes/actions/EditEntityAction.php(262): Wikibase\EditEntityAction->showUndoForm()
#2 /srv/mediawiki/php-1.26wmf2/includes/MediaWiki.php(395): Wikibase\EditEntityAction->show()
#3 /srv/mediawiki/php-1.26wmf2/includes/MediaWiki.php(273): MediaWiki->performAction()
#4 /srv/mediawiki/php-1.26wmf2/includes/MediaWiki.php(566): MediaWiki->performRequest()
#5 /srv/mediawiki/php-1.26wmf2/includes/MediaWiki.php(414): MediaWiki->main()
#6 /srv/mediawiki/php-1.26wmf2/index.php(46): MediaWiki->run()
#7 /srv/mediawiki/w/index.php(3): include()
```
Possible cause: trying to undo an edit that turned an entity into a redirect (or vice versa), when that edit is not the latest edit (that is, when the undo involved diff-based patching).
Incomplete (@Addshore please complete) reproduction path:
If edit A changed a label on Qx, edit B turned Qx into a redirect, edit A cannot be undone, because a label edit cannot apply to a redirect.
Possible fix: when an undo is requested, first check whether the current revision has the same redirect status as the revision to be undone. If not, undo should fail gracefully.
**Acceptance Criteria**
[] reproducing the issue results in an error displayed neatly to the user, something along the lines of "undo not possible"
[] Error does not appear in production logs