API:Errors and warnings

If something goes wrong in an API request, an error or a warning will be thrown (although the HTTP response will usually still be ). Warnings are thrown for non-fatal conditions such as invalid parameters, whereas errors are only thrown for fatal conditions.

Warnings
Warnings are output in the following format: As shown in the example, warnings are grouped by the name of the module that caused them. Multiple warnings from the same module are separated by a newline.

Disabled submodules
Disabled  submodules will always throw the following warning:
 * The "modulename" module has been disabled.

Missing submodules
If a submodule is not present on a wiki, for example it is implemented by an extension that isn't loaded, then requesting throws the warning "Unrecognized value for parameter ..." and possibly additional warnings for the submodule's parameters. For example for a list query submodule, raremodule, returns
 * "Unrecognized value for parameter 'list': raremodule"

You can check to see if a module is available before invoking it, see [How do I] check if an API module is available? in the FAQ.

Parameter validation warnings
The MediaWiki API may return the following warnings when validating parameters of any API module. is replaced by the name of the parameter.


 * Too many values supplied for parameter ' paramname ' : the limit is limit
 * Unrecognized value for parameter ' paramname ' : value
 * Unrecognized values for parameter ' paramname ' : value1, value2, value3

Errors
The MediaWiki API returns errors in the following structure (shown for ): Where codestring is a short error code (which need not be unique to the error) and info text is a more elaborate description of the error (which should be unique). Also, it returns the error code in a  HTTP header. For an example error response or to test your client's error handling, visit https://en.wikipedia.org/w/api.php?action=blah

Note that when viewing errors in pretty-print formats, the API help will be returned inside the  element. To save bandwidth, this doesn't happen for non-pretty-print formats; if you specifically want the help text in a non-pretty-print format, use.

Error messages in the documentation
Error messages are documented as follows:

Which corresponds to:

Disabled modules
Disabled  modules will always fail with the following error:

Missing modules
If a module is not present on a wiki, for example it is implemented by an extension that isn't loaded, then requesting its action throws the error

You can check to see if a module is available before invoking it, see [How do I] check if an API module is available? in the FAQ.

Parameter validation errors
The MediaWiki API can "throw" the following errors when validating parameters of any API modules.

Standard error messages
Some generic error messages are shared among modules. If a module can throw these errors, that's explicitly mentioned in its  section.