Example failure: https://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=sistema%20parlamentario%20con%20sede%20de%20gobierno&srenablerewrites=yes&srinterwiki=1
Log message: https://logstash.wikimedia.org/app/kibana#/doc/logstash-*/logstash-2018.01.02/mediawiki/?id=AWC4yTHthTduSC7pBP2q
Stack trace:
#0 /srv/mediawiki/php-1.31.0-wmf.12/extensions/CirrusSearch/includes/Search/RescoreBuilders.php(76): CirrusSearch\Search\RescoreBuilder->getSupportedProfile(string) #1 /srv/mediawiki/php-1.31.0-wmf.12/extensions/CirrusSearch/includes/Search/SearchContext.php(599): CirrusSearch\Search\RescoreBuilder->__construct(CirrusSearch\Search\SearchContext) #2 /srv/mediawiki/php-1.31.0-wmf.12/extensions/CirrusSearch/includes/Search/SearchRequestBuilder.php(109): CirrusSearch\Search\SearchContext->getRescore() #3 /srv/mediawiki/php-1.31.0-wmf.12/extensions/CirrusSearch/includes/Searcher.php(516): CirrusSearch\Search\SearchRequestBuilder->build() #4 /srv/mediawiki/php-1.31.0-wmf.12/extensions/CirrusSearch/includes/Searcher.php(360): CirrusSearch\Searcher->buildSearch() #5 /srv/mediawiki/php-1.31.0-wmf.12/extensions/CirrusSearch/includes/CirrusSearch.php(388): CirrusSearch\Searcher->searchText(string, boolean) #6 /srv/mediawiki/php-1.31.0-wmf.12/extensions/CirrusSearch/includes/CirrusSearch.php(303): CirrusSearch->searchTextReal(string, CirrusSearch\HashSearchConfig, boolean) #7 /srv/mediawiki/php-1.31.0-wmf.12/extensions/CirrusSearch/includes/CirrusSearch.php(183): CirrusSearch->searchTextSecondTry(string, Status) #8 /srv/mediawiki/php-1.31.0-wmf.12/includes/api/ApiQuerySearch.php(97): CirrusSearch->searchText(string) #9 /srv/mediawiki/php-1.31.0-wmf.12/includes/api/ApiQuerySearch.php(43): ApiQuerySearch->run() #10 /srv/mediawiki/php-1.31.0-wmf.12/includes/api/ApiQuery.php(253): ApiQuerySearch->execute() #11 /srv/mediawiki/php-1.31.0-wmf.12/includes/api/ApiMain.php(1582): ApiQuery->execute() #12 /srv/mediawiki/php-1.31.0-wmf.12/includes/api/ApiMain.php(544): ApiMain->executeAction() #13 /srv/mediawiki/php-1.31.0-wmf.12/includes/api/ApiMain.php(515): ApiMain->executeActionWithErrorHandling() #14 /srv/mediawiki/php-1.31.0-wmf.12/api.php(94): ApiMain->execute() #15 /srv/mediawiki/w/api.php(3): include(string) #16 {main}
It looks like what's happening here is SearchApi.php trait is setting the default SearchEngine::FT_QUERY_INDEP_PROFILE_TYPE based on the local wiki configuration, and when loading the config and querying the other wiki the profile doesn't exist. First level fix should probably be to only set the profile if a user explicitly provided one. That only solves the most obvious occurance of the problem though, a user explicitly setting the qiprofile can still experience the error. We might need to have a way for the non-existent profile to fallback to the default profile instead of bailing out.