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 ...", for example for a list query submodule, funkymodule, returns
 * "Unrecognized value for parameter 'list': funkymodule"

You should check to see if a module is available before invoking it, see Xxx

Parameter validation warnings
The following warnings can be thrown when validating parameters, and can therefore be thrown by all modules. 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
Error messages are output in the following format: Where  is replaced with a short error code (which need not be unique to the error) and   with a more elaborate description of the error (which is unique). Also, the error code will be returned in the  HTTP header. For an example error response or to test your client's error handling, see http://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:

Parameter validation errors
The following errors can be thrown when validating parameters, and can therefore be thrown by all modules. is replaced by the name of the parameter.

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.