Page MenuHomePhabricator

"Bad content model: expected wikitext but got javascript" while saving/stashing an edit
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.37

message
MWException: Bad content model: expected wikitext but got javascript.

Impact

Notes

Details

Request ID
35714809-dd50-47c5-9b37-2fa00d4a7bf2
Request URL
https://fa.wikipedia.org/w/api.php
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.37/includes/content/TextContentHandler.php(70): ContentHandler->checkModelID(string)
#1 /srv/mediawiki/php-1.35.0-wmf.37/includes/api/ApiStashEdit.php(120): TextContentHandler->merge3(WikitextContent, WikitextContent, JavaScriptContent)
#2 /srv/mediawiki/php-1.35.0-wmf.37/includes/api/ApiMain.php(1585): ApiStashEdit->execute()
#3 /srv/mediawiki/php-1.35.0-wmf.37/includes/api/ApiMain.php(525): ApiMain->executeAction()
#4 /srv/mediawiki/php-1.35.0-wmf.37/includes/api/ApiMain.php(496): ApiMain->executeActionWithErrorHandling()
#5 /srv/mediawiki/php-1.35.0-wmf.37/api.php(84): ApiMain->execute()
#6 /srv/mediawiki/w/api.php(3): require(string)
#7 {main}

Event Timeline

Krinkle renamed this task from Bad content model: expected wikitext but got javascript. to MWException: "Bad content model: expected wikitext but got javascript" (ContentHandler.php).Jun 17 2020, 6:47 PM
Krinkle triaged this task as High priority.
Krinkle updated the task description. (Show Details)
Krinkle moved this task from Untriaged to Jun 2020 on the Wikimedia-production-error board.

The page was originally created in Draft namespace (default contentmodel = wikitext ). The author likely then attempted editing it, thus the revision he fetched was in wikitext contentmodel. He took like 17 minutes working on the edit, and in the meanwhile, the content model of the page was changed to javascript. Later when he wanted to save, exception was thrown in ContentHanlder since the page now has content model different from that of the fetched revision. In EditPage this is handled with 'contentmodelediterror' error, but the API is not handling it.

Change 606844 had a related patch set uploaded (by Ammarpad; owner: Ammarpad):
[mediawiki/core@master] API: Handle ContentHandler exception for content model mismatch

https://gerrit.wikimedia.org/r/606844

Krinkle renamed this task from MWException: "Bad content model: expected wikitext but got javascript" (ContentHandler.php) to "Bad content model: expected wikitext but got javascript" while saving/stashing an edit.Jun 24 2020, 6:22 PM
Krinkle added a project: Performance-Team.
Krinkle moved this task from Inbox to Doing (old) on the Performance-Team board.
Krinkle added a subscriber: Krinkle.

Reflecting Gerrit state.

Change 606844 merged by jenkins-bot:
[mediawiki/core@master] API: Handle ContentHandler exception for content model mismatch

https://gerrit.wikimedia.org/r/606844

Ammarpad claimed this task.
Ammarpad added a subscriber: aaron.