Last modified: 2008-04-12 18:49:59 UTC
"Automatically resolve redirects"-feature on Wikipedia API causes error with at least one particular page at Finnish Wikipedia (fi.wikipedia.org). I'm not sure whether this is a bug with the API or with the database. The last time the feature worked correctly for me was on April 4th 2008. The first time the feature gave me an error was on April 8th 2008. 1) An example of a page that doesn't work: http://fi.wikipedia.org/w/api.php?action=query&titles=Viittomakieli&prop=categories&redirects <?xml version="1.0" encoding="utf-8"?> <api> <error code="internal_api_error_MWException" info="Exception Caught: Internal error in ApiPageSet::getRedirectTargets: Invalid redirect IDs were found"> #0 /usr/local/apache/common-local/php-1.5/includes/api/ApiBase.php(659): wfDebugDieBacktrace('Internal error ...') #1 /usr/local/apache/common-local/php-1.5/includes/api/ApiPageSet.php(540): ApiBase::dieDebug('ApiPageSet::get...', 'Invalid redirec...') #2 /usr/local/apache/common-local/php-1.5/includes/api/ApiPageSet.php(494): ApiPageSet->getRedirectTargets() #3 /usr/local/apache/common-local/php-1.5/includes/api/ApiPageSet.php(365): ApiPageSet->resolvePendingRedirects() #4 /usr/local/apache/common-local/php-1.5/includes/api/ApiPageSet.php(250): ApiPageSet->initFromTitles(Array) #5 /usr/local/apache/common-local/php-1.5/includes/api/ApiQuery.php(197): ApiPageSet->execute() #6 /usr/local/apache/common-local/php-1.5/includes/api/ApiMain.php(354): ApiQuery->execute() #7 /usr/local/apache/common-local/php-1.5/includes/api/ApiMain.php(222): ApiMain->executeAction() #8 /usr/local/apache/common-local/php-1.5/includes/api/ApiMain.php(207): ApiMain->executeActionWithErrorHandling() #9 /usr/local/apache/common-local/php-1.5/api.php(77): ApiMain->execute() #10 /usr/local/apache/common-local/live-1.5/api.php(3): require('/usr/local/apac...') #11 {main} </error> </api> 2) An example of a page that does work: http://fi.wikipedia.org/w/api.php?action=query&titles=Retinitis_pigmentosa&prop=categories&redirects You are looking at the HTML representation of the XML format. HTML is good for debugging, but probably is not suitable for your application. See complete documentation, or API help for more information. <?xml version="1.0" encoding="utf-8"?> <api> <query> <normalized> <n from="Retinitis_pigmentosa" to="Retinitis pigmentosa" /> </normalized> <redirects> <r from="Retinitis pigmentosa" to="Verkkokalvorappeuma" /> </redirects> <pages> <page pageid="151254" ns="0" title="Verkkokalvorappeuma"> <categories> <cl ns="14" title="Luokka:Lääketiedetyngät" /> <cl ns="14" title="Luokka:Perinnölliset sairaudet" /> <cl ns="14" title="Luokka:Silmätaudit" /> </categories> </page> </pages> </query> </api>
This is because some old redirects don't have entires in the redirect table. This can be fixed by editing the redirect (changing #redirect to #REDIRECT or the other way around). I agree this condition should be handled more gracefully, but I'm waiting for replies to bug 10931 comment #19 first.
I don't think this should depend on bug 10931; unless you can guarantee that the redirect table of ''every'' wiki will ''always'' be 100% up-to-date, the API still needs to be able to deal gracefully with missing entries.
(In reply to comment #2) > I don't think this should depend on bug 10931; unless you can guarantee that > the redirect table of ''every'' wiki will ''always'' be 100% up-to-date, the > API still needs to be able to deal gracefully with missing entries. > That's not what I said. In bug 10931 comment #19 I suggested a procedure for keeping the redirect table more up-to-date. If that procedure is approved, I can use it in the API too (i.e. if the API encounters redirects that aren't in the redirect table, it'll add them).
*** Bug 13661 has been marked as a duplicate of this bug. ***
something has made this error much more common on en.wp in the last day or two. i never saw it before and now it is all over the place. love the #10931 proposed change but i will love a graceful failure even more.
I agree with Aaron. I never saw this problem before yesterday (at fi.wikipedia.org). I'd need API-queries with more than one title at time and now only one problematic redirect fail the whole query (and it's up to me to find out which one). Anyway, thanks a lot for quick and informal answers and, of course, for the already wonderful work for the API :)
(In reply to comment #5) > love the #10931 > proposed change but i will love a graceful failure even more. Well once bug 10931 is fixed, we won't need graceful failures; we won't even *have* failures any more, because the following two requests: index.php?title=Foo api.php?action=query&titles=Foo&redirects will both add an entry to the redirect table if it's missing.
Fixed in r33133
*** Bug 13717 has been marked as a duplicate of this bug. ***