Steps to reproduce:
- While logged out, go to edit a protected page and click on "View source" or go to action=edit via a direct link, such as https://en.wikipedia.org/w/index.php?title=Test&action=edit
- You are prompted on whether to use VisualEditor or wikitext. I think this is the main issue – the option to use VisualEditor shouldn't even be there if they are unable to edit, or at least we shouldn't lead them to believe they'll be able to edit.
- Click on "Switch to VisualEditor"
- From here it seems you are able to edit, which is adverse because one might spend considerable time on an edit that won't go through. This would be prevented with #2 above.
- Makes some changes an attempt to save them.
- You will receive the error: "Something went wrong": [(random hash)] Exception caught: Invalid code "404". The random hash was WGyVnQpAEDMAAa7HZiQAAACD when I attempted, but changes on every attempt.
So the problem here is VisualEditor is intercepting the edit request workflow. A prime example: As an experienced user trying to help a newbie, you may give them the direct edit link so they will be able to click the "Submit an edit request" button. I don't think there's any reason to load the VisualEditor app at that point, just show MediaWiki:Protectedpagetext.
Turning this bug into a solution for making edit requests
Submitting an edit request as a newbie has never been easy. At least on enwiki, we ask for the request to be in the form of "turn A into B", which they rarely do. So what if we allowed them to make an edit request through VisualEditor? Imagine in the above step #2, it instead showed the message "You can submit an edit request manually or use VisualEditor to request your changes". Then in step #4, they make the changes they'd like to propose, and hit "Submit edit request" (shown instead of "Save") and bam, we have the removed and added lines of the edit which can be supplied to the edit request template. I will safely assume this "edit request" process varies wiki to wiki, so maybe this really cool idea won't work. But it's still really cool, and I thought I'd bring it up :)