Error codes
Errors are returned in the standard GraphQL errors array. The machine-readable code is in extensions.code:
{
"errors": [
{
"message": "<human-readable description>",
"extensions": { "code": "INVALID_JOB_STATE" }
}
],
"data": null
}
Branch on extensions.code, not message. Message text may change.
MPX uses the following codes in addition to the Apollo Server built-in error codes.
Authentication
| Code | Meaning |
|---|---|
INVALID_AUTHORIZATION_SCOPE_ERROR | The access token is missing, invalid, expired, or doesn't have the mpx:vendor scope. |
AUTHORIZATION_VENDOR_NOT_FOUND | The access token is valid but isn't linked to a vendor. |
Jobs
| Code | Meaning |
|---|---|
INVALID_JOB_ID | The job ID is invalid. This usually means it's an empty string. |
JOB_NOT_FOUND | The job doesn't exist, or your vendor doesn't have permission to see it. |
INVALID_VENDOR_ERROR | The job (or technician) belongs to another vendor. |
JOB_NETWORK_ERROR | Your vendor isn't in the job's network. Only checked while the job is AVAILABLE. |
INVALID_JOB_STATE | The job's status doesn't allow this mutation. See Allowed states per mutation. |
INVALID_JOB_ERROR | unassignJob was called on a job with no assignee. |
JOB_ALREADY_CLAIMED | declineJob was called on a job that already belongs to your vendor. |
INVALID_JOB_ASSIGNEE | The assignee doesn't exist, isn't a technician, or doesn't belong to your vendor. |
INVALID_REASON_NOTE | completeJob was called with an empty note and a reason other than Sample_Completely_Obtained_and_Shipped. |
INVALID_OTHER_NOTE | cancelJob was called with reason Other and no note. |
INVALID_SHIPPING_CARRIER | addJobTrackingNumber was called with carrier OTHER but no other value. |
INVALID_START_TIME | The startTime passed to scheduleJob is invalid. |
INVALID_END_TIME | The endTime passed to scheduleJob is invalid. |
SLOT_UNAVAILABLE | The requested schedule time is no longer available. |
JOB_CONNECTION_ERROR | jobConnection failed. Check your arguments. |
Technicians
| Code | Meaning |
|---|---|
TECHNICIAN_NOT_FOUND | The technician doesn't exist. |
USER_ALREADY_CREATED_ERROR | A user with that email already exists. |
ZIP_CODE_NOT_FOUND | MPX doesn't recognize the ZIP code. |
ERROR_ACTIVATING_TECHNICIAN / ERROR_DEACTIVATING_TECHNICIAN | The technician's status couldn't be changed. |
TECHNICIAN_CONNECTION_ERROR | technicianConnection failed. Check your arguments. |
Webhooks
| Code | Meaning |
|---|---|
WEBHOOK_NOT_FOUND | No webhook is registered for that action. |
CREATE_WEBHOOK_ERROR / UPDATE_WEBHOOK_ERROR / DELETE_WEBHOOK_ERROR | The webhook couldn't be saved or removed. |
General
| Code | Meaning |
|---|---|
VALIDATION_ERROR | An input failed validation. For example, first is out of range, a phone number is invalid, or a webhook URL isn't https. extensions.validationErrors lists the failing fields. |
INTERNAL_SERVER_ERROR | Unknown error. If it persists, contact MPX support. |
For REST attachment upload errors, see Attachments.