Steps to reproduce:
Visit a wiki, open your javascript console, and run the following (assuming you don't have apihighlimits rights, if you do you'll need 501 messages to test with instead of 51)
// A collection of 51 different valid messages in MediaWiki var missingMessages = [ "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sun", "mon", "tue", "wed", "thu", "fri", "sat", "january", "february", "march", "april", "may_long", "june", "july", "august", "september", "october", "november", "december", "january-gen", "february-gen", "march-gen", "april-gen", "may-gen", "june-gen", "july-gen", "august-gen", "september-gen", "october-gen", "november-gen", "december-gen", "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec", "january-date" ]; // Make sure that these are all indeed not yet loaded, using the same logic that mw.api.loadMessagesIfMissing does to check missingMessages.filter( function ( msg ) { return !mw.message( msg ).exists(); } ).length === 51 // should be true // Try to load (new mw.Api()).loadMessagesIfMissing( missingMessages ).then( function () { console.log( 'loaded' ); }, function () { console.log( 'Error', arguments ); } );
Expected result: messages are loaded (at least the first 50)
Actual result: api failure with code toomanyvalues
Proposal: only retrieve 50 messages at a time, calling the method recursively if needed