debugging I look at the values of the response that gave an error (they are below).
What catches my attention is 'requestPath': transform/wikitext/to/html/User%3AJohn%2Ftestpage
and I suspect the problem comes from : and / being sanitized to %3A and %2F. Which I believe is unnecessary.
After seeing this, and to check if the premise is correct, I checked if creating subpages in the Main namespace also gives an error. And it does.
So this looks like its a bug?
'code':
404
'trace':
#0 /var/www/html/w/extensions/VisualEditor/includes/ApiVisualEditor.php(67): ApiVisualEditor->requestRestbase(Object(Title), 'POST', 'transform/wikit...', Array)
#1 /var/www/html/w/extensions/VisualEditor/includes/ApiVisualEditor.php(251): ApiVisualEditor->parseWikitextFragment(Object(Title), 'testtext', false, NULL, true)
#2 /var/www/html/w/includes/api/ApiMain.php(1593): ApiVisualEditor->execute()
#3 /var/www/html/w/includes/api/ApiMain.php(529): ApiMain->executeAction()
#4 /var/www/html/w/includes/api/ApiMain.php(500): ApiMain->executeActionWithErrorHandling()
#5 /var/www/html/w/api.php(90): ApiMain->execute()
#6 /var/www/html/w/api.php(45): wfApiMain()
#7 {main}
'response':
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>404 Not Found</title> </head><body> <h1>Not Found</h1> <p>The requested URL was not found on this server.</p> <hr> <address>Apache/2.4.38 (Debian) Server at localhost Port 80</address> </body></html>
'requestPath':
transform/wikitext/to/html/User%3AJohn%2Ftestpage