Page MenuHomePhabricator

Intermittent internal API error MWUnknownContentModelException
Closed, ResolvedPublic

Description

Pywikibot tests on wpbeta and testwiki are failing lately with the following error:

________________________ TestPageObject.testReferences _________________________

self = <tests.page_tests.TestPageObject testMethod=testReferences>

    def testReferences(self):

        """Test references to a page."""

        mainpage = self.get_mainpage()

        count = 0

        # Ignore redirects for time considerations

>       for p in mainpage.getReferences(follow_redirects=False):

tests/page_tests.py:504: 

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pywikibot/data/api.py:2846: in __iter__

    self.data = self.request.submit()

pywikibot/data/api.py:2273: in submit

    self._data = super(CachedRequest, self).submit()

pywikibot/data/api.py:2057: in submit

    if self._internal_api_error(code, error, result):

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = tests.TestRequest<wpbeta:en->'/w/api.php?inprop=protection&gbltitle=Main+Page&...&iiprop=timestamp|user|comment|url|size|sha1|metadata&uiprop=blockinfo|hasmsg'>

code = 'internal_api_error_MWUnknownContentModelException'

error = {'*': 'MWUnknownContentModelException at /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(201)

#0 .../wiki/Content_handlers to find out which extensions handle this content model.", 'servedby': 'deployment-mediawiki-07'}

result = {'error': {'code': 'internal_api_error_MWUnknownContentModelException', 'errorclass': 'MWUnknownContentModelException'...wiki/Content_handlers to find out which extensions handle this content model."}, 'servedby': 'deployment-mediawiki-07'}

    def _internal_api_error(self, code, error, result):

        """Check for internal_api_error_ or readonly and retry.

    

        @raises APIMWException: internal_api_error or readonly

        """

        IAE = 'internal_api_error_'

        if not (code.startswith(IAE) or code == 'readonly'):

            return False

    

        # T154011

        class_name = code if code == 'readonly' else code[len(IAE):]

    

        del error['code']  # is added via class_name

        e = APIMWException(class_name, **error)

    

        # If the error key is in this table, it is probably a temporary

        # problem, so we will retry the edit.

        # TODO: T154011: 'ReadOnlyError' seems replaced by 'readonly'

        retry = class_name in ['DBConnectionError',  # T64974

                               'DBQueryError',  # T60158

                               'ReadOnlyError',  # T61227

                               'readonly',  # T154011

                               ]

    

        pywikibot.error('Detected MediaWiki API exception {}{}'

                        .format(e, '; retrying' if retry else '; raising'))

        # Due to bug T66958, Page's repr may return non ASCII bytes

        # Get as bytes in PY2 and decode with the console encoding as

        # the rest should be ASCII anyway.

        param_repr = str(self._params)

        if PY2:

            param_repr = param_repr.decode(config.console_encoding)

        pywikibot.log('MediaWiki exception {} details:\n'

                      '          query=\n{}\n'

                      '          response=\n{}'

                      .format(class_name,

                              pprint.pformat(param_repr),

                              result))

        if not retry:

>           raise e

E           APIMWException: internal_api_error_MWUnknownContentModelException: [XuHwcawQBHcAAG3SaIsAAAAW] Exception caught: The content model 'CollaborationListContent' is not registered on this wiki. See https://www.mediawiki.org/wiki/Content_handlers to find out which extensions handle this content model.

E           [errorclass: MWUnknownContentModelException;

E            *: MWUnknownContentModelException at /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(201)

E           #0 /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(266): MediaWiki\Content\ContentHandlerFactory->validateContentHandler(string, NULL)

E           #1 /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(189): MediaWiki\Content\ContentHandlerFactory->createContentHandlerFromHook(string)

E           #2 /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(97): MediaWiki\Content\ContentHandlerFactory->createForModelID(string)

E           #3 /srv/mediawiki/php-master/includes/Title.php(4395): MediaWiki\Content\ContentHandlerFactory->getContentHandler(string)

E           #4 /srv/mediawiki/php-master/includes/api/ApiQueryInfo.php(414): Title->getPageLanguage()

E           #5 /srv/mediawiki/php-master/includes/api/ApiQueryInfo.php(385): ApiQueryInfo->extractPageInfo(integer, Title)

E           #6 /srv/mediawiki/php-master/includes/api/ApiQuery.php(263): ApiQueryInfo->execute()

E           #7 /srv/mediawiki/php-master/includes/api/ApiMain.php(1585): ApiQuery->execute()

E           #8 /srv/mediawiki/php-master/includes/api/ApiMain.php(525): ApiMain->executeAction()

E           #9 /srv/mediawiki/php-master/includes/api/ApiMain.php(496): ApiMain->executeActionWithErrorHandling()

E           #10 /srv/mediawiki/php-master/api.php(84): ApiMain->execute()

E           #11 /srv/mediawiki/w/api.php(3): require(string)

E           #12 {main};

E            servedby: deployment-mediawiki-07]

pywikibot/data/api.py:1910: APIMWException

------------------------------ Captured log call -------------------------------

logging.py                 109 WARNING  API error internal_api_error_MWUnknownContentModelException: [XuHwcawQBHcAAG3SaIsAAAAW] Exception caught: The content model 'CollaborationListContent' is not registered on this wiki. See https://www.mediawiki.org/wiki/Content_handlers to find out which extensions handle this content model.

logging.py                 109 ERROR    Detected MediaWiki API exception internal_api_error_MWUnknownContentModelException: [XuHwcawQBHcAAG3SaIsAAAAW] Exception caught: The content model 'CollaborationListContent' is not registered on this wiki. See https://www.mediawiki.org/wiki/Content_handlers to find out which extensions handle this content model.

[errorclass: MWUnknownContentModelException;

 *: MWUnknownContentModelException at /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(201)

#0 /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(266): MediaWiki\Content\ContentHandlerFactory->validateContentHandler(string, NULL)

#1 /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(189): MediaWiki\Content\ContentHandlerFactory->createContentHandlerFromHook(string)

#2 /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(97): MediaWiki\Content\ContentHandlerFactory->createForModelID(string)

#3 /srv/mediawiki/php-master/includes/Title.php(4395): MediaWiki\Content\ContentHandlerFactory->getContentHandler(string)

#4 /srv/mediawiki/php-master/includes/api/ApiQueryInfo.php(414): Title->getPageLanguage()

#5 /srv/mediawiki/php-master/includes/api/ApiQueryInfo.php(385): ApiQueryInfo->extractPageInfo(integer, Title)

#6 /srv/mediawiki/php-master/includes/api/ApiQuery.php(263): ApiQueryInfo->execute()

#7 /srv/mediawiki/php-master/includes/api/ApiMain.php(1585): ApiQuery->execute()

#8 /srv/mediawiki/php-master/includes/api/ApiMain.php(525): ApiMain->executeAction()

#9 /srv/mediawiki/php-master/includes/api/ApiMain.php(496): ApiMain->executeActionWithErrorHandling()

#10 /srv/mediawiki/php-master/api.php(84): ApiMain->execute()

#11 /srv/mediawiki/w/api.php(3): require(string)

#12 {main};

 servedby: deployment-mediawiki-07]; raising

logging.py                 109 VERBOSE  MediaWiki exception MWUnknownContentModelException details:

          query=

u"{u'inprop': [u'protection'], u'gbltitle': [u'Main Page'], u'gblfilterredir': [u'nonredirects'], u'maxlag': ['5'], u'generator': [u'backlinks'], u'format': [u'json'], u'gbllimit': [u'500'], u'prop': [u'info', u'imageinfo', u'categoryinfo'], u'iilimit': [u'max'], u'continue': [True], u'meta': [u'userinfo'], u'indexpageids': [True], u'action': [u'query'], u'iiprop': [u'timestamp', u'user', u'comment', u'url', u'size', u'sha1', u'metadata'], u'uiprop': [u'blockinfo', u'hasmsg']}"

          response=

{u'servedby': u'deployment-mediawiki-07', u'error': {u'info': u"[XuHwcawQBHcAAG3SaIsAAAAW] Exception caught: The content model 'CollaborationListContent' is not registered on this wiki. See https://www.mediawiki.org/wiki/Content_handlers to find out which extensions handle this content model.", u'errorclass': u'MWUnknownContentModelException', u'code': u'internal_api_error_MWUnknownContentModelException', u'help': u'MWUnknownContentModelException at /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(201)\n#0 /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(266): MediaWiki\\Content\\ContentHandlerFactory->validateContentHandler(string, NULL)\n#1 /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(189): MediaWiki\\Content\\ContentHandlerFactory->createContentHandlerFromHook(string)\n#2 /srv/mediawiki/php-master/includes/content/ContentHandlerFactory.php(97): MediaWiki\\Content\\ContentHandlerFactory->createForModelID(string)\n#3 /srv/mediawiki/php-master/includes/Title.php(4395): MediaWiki\\Content\\ContentHandlerFactory->getContentHandler(string)\n#4 /srv/mediawiki/php-master/includes/api/ApiQueryInfo.php(414): Title->getPageLanguage()\n#5 /srv/mediawiki/php-master/includes/api/ApiQueryInfo.php(385): ApiQueryInfo->extractPageInfo(integer, Title)\n#6 /srv/mediawiki/php-master/includes/api/ApiQuery.php(263): ApiQueryInfo->execute()\n#7 /srv/mediawiki/php-master/includes/api/ApiMain.php(1585): ApiQuery->execute()\n#8 /srv/mediawiki/php-master/includes/api/ApiMain.php(525): ApiMain->executeAction()\n#9 /srv/mediawiki/php-master/includes/api/ApiMain.php(496): ApiMain->executeActionWithErrorHandling()\n#10 /srv/mediawiki/php-master/api.php(84): ApiMain->execute()\n#11 /srv/mediawiki/w/api.php(3): require(string)\n#12 {main}'}}

https://travis-ci.org/github/wikimedia/pywikibot/jobs/696087418#L1238
https://travis-ci.org/github/dvorapa/pywikibot/jobs/697066541#L1335

Note: Created as a copy of T249705

Event Timeline

Started to fail cca 4 hours ago, tests passed before. Fails currently only on testwiki and enwpbeta. The following two tests are failing (both should be extremely easy to understand):

https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/tests/page_tests.py$504
https://phabricator.wikimedia.org/diffusion/PWBC/browse/master/tests/site_tests.py$2257

Dvorapa assigned this task to Urbanecm.