Page MenuHomePhabricator

Some ApiParse requests fail due to fatal MWException: "not supported for content model"
Open, LowPublicPRODUCTION ERROR

Description

Error

Request ID: W6M@7grAMG8AAAerQtQAAABL
Request: GET, /w/api.php?...prop=wikitext..&contentformat=text/plain

exception
MWException: Format text/plain is not supported for content model wikitext

#0 /srv/mediawiki/php-1.32.0-wmf.20/includes/content/TextContentHandler.php(46): ContentHandler->checkFormat(string)
#1 /srv/mediawiki/php-1.32.0-wmf.20/includes/content/AbstractContent.php(155): TextContentHandler->serializeContent(WikitextContent, string)
#2 /srv/mediawiki/php-1.32.0-wmf.20/includes/api/ApiParse.php(463): AbstractContent->serialize(string)
#3 /srv/mediawiki/php-1.32.0-wmf.20/includes/api/ApiMain.php(1587): ApiParse->execute()
#4 /srv/mediawiki/php-1.32.0-wmf.20/includes/api/ApiMain.php(531): ApiMain->executeAction()
#5 /srv/mediawiki/php-1.32.0-wmf.20/includes/api/ApiMain.php(502): ApiMain->executeActionWithErrorHandling()
#6 /srv/mediawiki/php-1.32.0-wmf.20/api.php(87): ApiMain->execute()
#7 /srv/mediawiki/w/api.php(3): include(string)

Notes

API request fatal rate is increased due to this issue.

It appears that this is a matter of a certain feature not being available yet, or intentionally not provided. That's probably fine, at least in the short-term, but it needs to not crash the request to avoid false alarms. As a stop-gap solution it can probably be caught somewhere along the way and simply reject explicitly so as to mark it a user error (rather than server error).

Related:

Related Objects

StatusSubtypeAssignedTask
Declineddchen
OpenNone
OpenNone
DuplicateNone
OpenNone
OpenNone
OpenNone
StalledNone
OpenNone
DuplicateNone
ResolvedNone
OpenNone
OpenNone
OpenNone
OpenNone
ResolvedNone
ResolvedNone
OpenNone
StalledNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenPRODUCTION ERRORNone

Event Timeline

Anomie added a subscriber: Anomie.

What seems to be going on is that it's using a content format intended for interpretation of input text (of which there isn't any in that request) to try and format the output. It looks like ApiEditPage likely has the same issue.

The direct solution would be to remove the passing of a format when calling Content->serialize(). But since both of these modules are going to need some major work soon for MCR anyway, I'm probably not going to bother doing that as a separate patch.

Recently triggered via urls such as https://en.wikipedia.org/w/api.php?action=parse&page=Example&contentformat=application/json&prop=wikitext&section=2.

Suppressing in Logstash/new-errors is difficult due the message not having a normal form without variance by user input, and the exception file/line of TextContentHandler.php(46) is too wide.

Using ApiParse.php(463): AbstractContent->serialize(string) for now, seems to be the most specific, whilst still potentially ignoring other errors in the same kind of API call.

Krinkle renamed this task from Some ApiParse reqs fatal due to contentformat to Some ApiParse requests fail due to fatal MWException: "not supported for content model".Nov 4 2018, 8:44 PM
Krinkle added a project: Platform Engineering.

Still seen in the logs for 1.33-wmf.1. Stack trace changed, hence it resurfaced. Exposed from the same urls as T206253#4672796.

MWException: Format text/javascript is not supported for content model wikitext

#0 /srv/mediawiki/php-1.33.0-wmf.1/includes/content/TextContentHandler.php(116): ContentHandler->checkFormat(string)
#1 /srv/mediawiki/php-1.33.0-wmf.1/includes/content/ContentHandler.php(145): TextContentHandler->unserializeContent(string, string)
#2 /srv/mediawiki/php-1.33.0-wmf.1/includes/api/ApiParse.php(222): ContentHandler::makeContent(string, Title, string, string)
#3 /srv/mediawiki/php-1.33.0-wmf.1/includes/api/ApiMain.php(1570): ApiParse->execute()
#4 /srv/mediawiki/php-1.33.0-wmf.1/includes/api/ApiMain.php(531): ApiMain->executeAction()
#5 /srv/mediawiki/php-1.33.0-wmf.1/includes/api/ApiMain.php(502): ApiMain->executeActionWithErrorHandling()
#6 /srv/mediawiki/php-1.33.0-wmf.1/api.php(87): ApiMain->execute()
#7 /srv/mediawiki/w/api.php(3): include(string)
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:08 PM

Still seen in Logstash.

It's trivial to fix I believe, if someone is committing to review patch for that

Aklapper changed the task status from Stalled to Open.Oct 19 2020, 4:34 PM

The previous comments don't explain who or what (task?) exactly this task is stalled on ("If a report is waiting for further input (e.g. from its reporter or a third party) and can currently not be acted on"). Hence resetting task status.

(Smallprint, as general orientation for task management: If you wanted to express that nobody is currently working on this task, then the assignee should be removed and/or priority could be lowered instead. If work on this task is blocked by another task, then that other task should be added via Edit Related Tasks...Edit Subtasks. If this task is stalled on an upstream project, then the Upstream tag should be added. If this task requires info from the task reporter, then there should be instructions which info is needed. If this task needs retesting, then the TestMe tag should be added. If this task is either out of scope and nobody should ever work on this, or nobody else managed to reproduce the problem described in this task, then this task should have the "Declined" status. If the task is valid but should not appear on some team's workboard, then the team project tag should be removed while the task has another active project tag.)