Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

MNet Errors

From MoodleDocs

Introduction

This wiki page attempts to document all the MNET error codes, what they mean, where they're called from, and what cases can trigger them. As MNET is theoretically pluggable, this does not cover all exhaustive cases, just ones that are included in the core Moodle distribution.

System/Verification errors

712, "phperror"

This is called from the main mnet xmlrpc server (mnet/xmlrpc/server.php) when $_SERVER is unset.

7025

This is triggered when the peer used an older public key. This sends the xmlrpc server fault, with 7025 as the code, and the current public key as the text of the error message.

7021, "forbidden-transport"

This is triggered if a non-encrypted request is sent, and plaintext is disallowed (plaintext can be enabled for trusted hosts within a designated subnet)

711, "verifysignature-error"

This is triggered if a request wasn't signed

710, "verifysignature-invalid"

This is triggered if a request was signed, but not able to be verified

7020, "wrong-wwwroot"

This is triggered if the host record is unable to be found, based on the wwwroot inside the xmlrpc request. This can sometimes happen if you use www.mysite.com and mysite.com

7023, "encryption-invalid"

This is triggered if Moodle can't decrypt the message either with the current key, or with any of the keys in the history.

7014, "nosuchmethod"

This is triggered in the case that a class method has been requested, a new object has been constructed, but then the method cannot be called on the object.

Note that 7014 is also purportedly triggered with a "nosuchfunction" message in mnet_server_invoke_method, but it is in a non-executable piece of code.

7015, "nosuchfunction"

This is triggered in the case that the class doesn't export a list of published mnet methods, in either the case of the requested method being static, or not.

7000, "unknownerror"

For some reason the xmlrpc request cannot be processed. Generic failure message.

Dispatch errors

713, "nosuchfunction"

This is triggered if the function given in the xmlrpc request doesn't match the regular expression of allowed function calls (which must be of the form auth/mnet/auth.php/function_name)

704, "nosuchservice"

This is triggered if "Networking" is disabled in Admin -> Advanced Features, or $CFG->mnet_dispatcher_mode is "off".

7018, "nosuchfunction"

This is triggered if the xmlrpc request was for a system method (eg "listMethods", etc), but it wasn't in the list of allowed systemcalls. The complete list of system calls are:

  • listMethods
  • methodSignature
  • methodHelp
  • listServices
  • listFiles
  • retrieveFile
  • keyswap

7012, "nosuchfunction"

This is the generic error code for the inability to find a function.

7019, "nosuchfunction"

This is triggered in mnet_system() if a system method has been called, but it's not listMethods, methodSignature, methodHelp, or listServices. It looks as though listFiles or retrieveFile are not implemented, even though they are registered to mnet_system in the mnet_server_dispatch() function.

This is also triggered if mnet_permit_rpc_call returns a non-zero error code that hasn't already been trapped by one of the RPC_ constants defined in mnet/lib.php (which have their own error codes)

705, "nosuchfile"

This is triggered if the file requested cannot be found (eg auth/mnet/lib.php instead of auth/mnet/auth.php)

706, "nosuchfunction"

This is triggered if the xmlrpc request is for a function (rather than a static method or class method), and it cannot be called (eg function_exists fails)

707, "forbidden-function"

This happens when the function is found, but not allowed (either not published to this host, or disabled)

708, "nosuchclass"

This happens when the class couldn't be found - probably would only happen if someone hacked code, as the mnet function installer checks this before putting rpc methods in the database.

709, "classerror"

This happens when the class is found, but cannot be constructed - an error was thrown.

Authentication errors

702, "nosuchfunction"

This is triggered when the request was for an authentication method, but the authentication plugin requested wasn't enabled.

7013, "nosuchfunction"

This is triggered when a class or static method has been requested, but the class could not be founded (eg class_exists fails). The error message should be renamed in this case.

1, "authfail_nosessionexists"

This is triggered when there's no record in the mnet_session table for the given token and useragent.

2, "authfail_sessiontimedout"

This is triggered when there is a session, but confirmation has already timed out

3, "authfail_usermismatch"

This is triggered when Moodle can't find the user that the mnet session has been set up for. This is a weird error, but could possibly happen if the user was deleted between the mnet session being created, and confirmed.

Enrolment errors

703, "nosuchfunction"

This is triggered when the request was for an enrolment method, but the enrolment plugin requested wasn't enabled.

5011, "couldnotcreateuser"

This is triggered when a user is requested to be enrolled in a course, but the user doesn't exist and an error happens trying to create their record

5012, "coursenotfound"

This is triggered when a user is requested to be enrolled in a course, but the course doesn't exist

5013, "courseunavailable"

This is triggered when a user is requested to be enrolled in a course, but the course isn't in the whitelist of available courses

5014, "usernotfound"

This is triggered when a user is requested to be unenrolled from a course, but the user isn't found

5015, "couldnotunenrol"

This is triggered if role_unassign fails

5016, "couldnotenrol"

This is triggered if enrol_into_course fails

Portfolio errors

7012, "nosuchfunction"

This is triggered when an invalid filename is sent for a portfolio plugin. This should be changed to check that the portfolio plugin is enabled.

8009, "mnet_notoken"

This is triggered when Mahara requests a portfolio file from Moodle and Moodle can't find a token in the transfer queue.

8010, "mnet_noid"

This is triggered when Mahara requests a file, the queue record is found, but the transfer information cannot be rewoken (which can happen if permissions have changed or settings have changed in the meantime, or the transfer is expired)

8011, "mnet_wronghost"

This is trigered if the xmlrpc request comes from a different host than the queue record has been saved against

8012, "mnet_nofile"

This is triggered when Mahara requests a file, and Moodle can't find it

8013, "mnet_nofilecontents"

This is triggered when Mahara requests a file, Moodle portfolio records know which file to send, but the Files API throws an exception, or the file is empty.

Repository errors

7012, "nosuchfunction"

This is triggered when an invalid filename is sent for a repository plugin. This should be changed to check that the repository plugin is enabled.

9012, "usernotfound"

This is triggered when the local user is not registered in the remote Moodle site.

9013, "usercannotaccess"

This is triggered when the local user cannot access to this file on the remote Moodle site.

9014, "failtoretrievelist"

This is triggered when no file list could be retrieved from the remote Moodle site.

"Dangerous mode" errors

7012, "nosuchfunction"

This is triggered when $CFG->mnet_dispatcher_mode has been set to "dangerous", and the request is for something other than a file that ends in '.php', or the request comes from a client that isn't a trusted host