Page MenuHomePhabricator

Page title too long pages errors with nondescriptive message "has neither 'pageid' nor 'missing' attribute"
Closed, ResolvedPublic

Description

$ PYWIKIBOT2_NO_USER_CONFIG=1 python pywikibot/pwb.py shell -debug -log -verbose
No handlers could be found for logger "pywiki"
Pywikibot rc80c9e184da41f3a73769e71d4a6b19d62078229
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2]
Welcome to the Pywikibot interactive shell!
>>> import pywikibot
>>> pywikibot.Page(pywikibot.Site("commons", "commons"), u"File:Президент России — 2016-03-23 — Заседание рабочей группы по мониторингу и анализу правоприменительной практики в сфере предпринимательства.webm").exists()
Found 1 commons:commons processes running, including this one.
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/zhuyifei1999/pywikibot/pywikibot/page.py", line 714, in exists
    return self.site.page_exists(self)
  File "/home/zhuyifei1999/pywikibot/pywikibot/site.py", line 2963, in page_exists
    self.loadpageinfo(page)
  File "/home/zhuyifei1999/pywikibot/pywikibot/site.py", line 2886, in loadpageinfo
    self._update_page(page, query, 'loadpageinfo')
  File "/home/zhuyifei1999/pywikibot/pywikibot/site.py", line 2873, in _update_page
    api.update_page(page, pageitem, query.props)
  File "/home/zhuyifei1999/pywikibot/pywikibot/data/api.py", line 3122, in update_page
    "Page %s has neither 'pageid' nor 'missing' attribute" % pagedict['title'])
AssertionError: Page File:\u041f\u0440\u0435\u0437\u0438\u0434\u0435\u043d\u0442 \u0420\u043e\u0441\u0441\u0438\u0438 \u2014 2016-03-23 \u2014 \u0417\u0430\u0441\u0435\u0434\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u043f\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0443 \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043f\u0440\u0430\u0432\u043e\u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u0432 \u0441\u0444\u0435\u0440\u0435 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430.webm has neither 'pageid' nor 'missing' attribute
>>> 
Dropped throttle(s).
<type 'exceptions.AssertionError'>
CRITICAL: Closing network session.
Network session closed.

Corresponding logs:

2016-04-08 13:48:41             api.py, 1947 in             submit: DEBUG    API request to commons:commons (uses get: False):
Headers: {u'Content-Type': u'application/x-www-form-urlencoded'}
URI: u'/w/api.php'
Body: 'inprop=protection&titles=File%3A%D0%9F%D1%80%D0%B5%D0%B7%D0%B8%D0%B4%D0%B5%D0%BD%D1%82+%D0%A0%D0%BE%D1%81%D1%81%D0%B8%D0%B8+%E2%80%94+2016-03-23+%E2%80%94+%D0%97%D0%B0%D1%81%D0%B5%D0%B4%D0%B0%D0%BD%
D0%B8%D0%B5+%D1%80%D0%B0%D0%B1%D0%BE%D1%87%D0%B5%D0%B9+%D0%B3%D1%80%D1%83%D0%BF%D0%BF%D1%8B+%D0%BF%D0%BE+%D0%BC%D0%BE%D0%BD%D0%B8%D1%82%D0%BE%D1%80%D0%B8%D0%BD%D0%B3%D1%83+%D0%B8+%D0%B0%D0%BD%D0%B0%D0%BB%D
0%B8%D0%B7%D1%83+%D0%BF%D1%80%D0%B0%D0%B2%D0%BE%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D0%BD%D0%B8%D1%82%D0%B5%D0%BB%D1%8C%D0%BD%D0%BE%D0%B9+%D0%BF%D1%80%D0%B0%D0%BA%D1%82%D0%B8%D0%BA%D0%B8+%D0%B2+%D1%81%D1%84%D0%B
5%D1%80%D0%B5+%D0%BF%D1%80%D0%B5%D0%B4%D0%BF%D1%80%D0%B8%D0%BD%D0%B8%D0%BC%D0%B0%D1%82%D0%B5%D0%BB%D1%8C%D1%81%D1%82%D0%B2%D0%B0.webm&continue=&format=json&prop=info&meta=userinfo&indexpageids=&action=quer
y&maxlag=5&uiprop=blockinfo%7Chasmsg'
2016-04-08 13:48:42             api.py, 1980 in             submit: DEBUG    API response received from commons:commons:
{"batchcomplete":"","query":{"pageids":["-1"],"pages":{"-1":{"title":"File:\u041f\u0440\u0435\u0437\u0438\u0434\u0435\u043d\u0442 \u0420\u043e\u0441\u0441\u0438\u0438 \u2014 2016-03-23 \u2014 \u0417\u0430\
u0441\u0435\u0434\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0447\u0435\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u043f\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0443 \u0
438 \u0430\u043d\u0430\u043b\u0438\u0437\u0443 \u043f\u0440\u0430\u0432\u043e\u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\
u0438 \u0432 \u0441\u0444\u0435\u0440\u0435 \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430.webm","invalidreason":"The requested page titl
e is too long. It must be no longer than 255 bytes in UTF-8 encoding.","invalid":""}},"userinfo":{"id":0,"name":"...","anon":""}}}

Event Timeline

It is 262 bytes long. We see the same error at Commons.

Where did you obtain this title from?

Xqt triaged this task as Low priority.Apr 8 2016, 2:12 PM
Xqt subscribed.

Page title may not exceed 255 chars/bytes. This title does not exist on commons and I guess it will never exist due to this restriction. What is your intention of this bug?

Where did you obtain this title from?

Well, @Senapa had my tool upload this file to commons. The actual point is that "has neither 'pageid' nor 'missing' attribute" is quite nondescriptive, sorry for not mentioning explicitly.

zhuyifei1999 renamed this task from Page title too long pages "has neither 'pageid' nor 'missing' attribute" to Page title too long pages errors with nondestructive message "has neither 'pageid' nor 'missing' attribute".Apr 8 2016, 2:14 PM

Agreed. This should raise InvalidTitle during the Page constructor.

The actual point is that "has neither 'pageid' nor 'missing' attribute" is quite non-destructive

I agree. The api error message is more informative and should be displayed here.

zhuyifei1999 renamed this task from Page title too long pages errors with nondestructive message "has neither 'pageid' nor 'missing' attribute" to Page title too long pages errors with nondescriptive message "has neither 'pageid' nor 'missing' attribute".Apr 8 2016, 2:18 PM
This comment was removed by Mpaa.

Change 285092 had a related patch set uploaded (by Mpaa):
Provide more info in case of invalid page

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

Change 285092 merged by jenkins-bot:
Provide more info in case of invalid page

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

Magul claimed this task.
Magul removed Magul as the assignee of this task.
Magul subscribed.