# Token Status and Error Codes
source: https://developer.mastercard.com/mastercard-checkout-solutions/tutorial/m4m_migration/step6/index.md

## Step 6: Token Status and Error Codes {#step-6-token-status-and-error-codes}

You will only be able to migrate **ACTIVE** or **SUSPENDED** tokens to SCOF. Mastercard does not migrate unmapped or deleted tokens.

|  Token Status   |             Definition             |                                       Expected Behavior from Migration                                        |
|-----------------|------------------------------------|---------------------------------------------------------------------------------------------------------------|
| Active Token    | The token is fully active.         | Allowed to migrate successfully.                                                                              |
| Suspended Token | An issuer has suspended the token. | Allowed to migrate successfully.                                                                              |
| Cancelled Token | An issuer has deleted the token.   | Not allowed to migrate and MDES will return an error reason code of **INVALID_STATE** (HTTP 400 Bad Request). |

## Card Enrollment Error Responses {#card-enrollment-error-responses}

* **TOKEN_MIGRATION_NOT_ELIGIBLE**: Token was not in a status that was eligible for migration.

```javascript
  {
    "status": 400,
    "reason": "INVALID_STATE",
    "message": "Request cannot be executed due to the incorrect field value",
    "errordetail": [
      {
        "reason": "TOKEN_MIGRATION_NOT_ELIGIBLE",
        "message": "Token is not eligible for migration",
        "sourceType": "BODY",
        "source": "enrolmentReferenceData.enrolmentReferenceId"
      }   
    ]
  }
```

* **INVALID_TOKEN_REQUESTOR_ID**: Client is not authorized to TRID or TUR belongs to a different TRID than the one requested

```javascript
  {
    "status": 400,
    "reason": "INVALID_STATE",
    "message": "Request cannot be executed due to the incorrect field value",
    "errordetail": [
      {
      "reason": "INVALID_CONFIGURATION",
      "message": "Cannot process the request because it is malformed or has incorrect/missing fields or values. ",
      "sourceType": "BODY",
      "source": "enrollCardRequest.`serviceId`"
      }
    ]
  }
```

* **INVALID_TOKEN_REQUESTOR_ID** : Token was not found for the given TRID.

```javascript
  {
    "status": 400,
    "reason": "INVALID_STATE",
    "message": "Request cannot be executed due to the incorrect field value",
    "errordetail": [
      {
        "reason": "INVALID_TOKEN_UNIQUE_REFERENCE",
        "message": "Invalid Field Value",
        "sourceType": "BODY",
        "source": "enrolmentReferenceData.enrolmentReferenceId"
      }
    ]
  }
```

* **AUTO_TRID_SERVICEID_LINK_FAILURE** : The ServiceID is not linked to the TRID automatically. In order to use the new serviceId, migrate one TUR via the Enroll API.

```javascript
  {
    "status": 500,
    "reason": "INTERNAL_SERVER_ERROR",
    "message": "Internal processing exception",
    "errordetail": [
      {
        "reason": "AUTO_TRID_SERVICEID_LINK_FAILURE",
        "message": "We have successfully created a serviceId for your M4M TRID. In order to proceed, you must migrate one TUR via the Enroll API with your new serviceId to be able to enroll new cards on Secure Card on File. If you encounter further errors, please contact the admin. Any srcDpaIds that were submitted have been uploaded successfully.",
        "sourceType": "BODY",
        "source": "MerchantServiceImpl:DPA_CREATION"
      }
    ]
  }
```

Refer to the [Error Codes](https://developer.mastercard.com/mastercard-checkout-solutions/documentation/code-and-formats/index.md) for a full list of error scenarios, sample error responses, and http status codes.
