> For the complete documentation index, see [llms.txt](https://docs.digitalriver.com/commerce-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalriver.com/commerce-api/resources/reference/error-types-codes-and-objects.md).

# Error types, codes, and objects

## Change event error object

When DigitalRiver.js detects a problem with an [element](/commerce-api/resources/reference/elements.md), its [change event](/commerce-api/resources/reference/elements.md#change) returns an `error` contains a `type`, `code`, and `message`.

{% tabs %}
{% tab title="Change Event Error object" %}

```javascript
{
    "type": "validation_error",
    "code": "invalid_card_number",
    "message": "Your card number is invalid."
}
```

{% endtab %}
{% endtabs %}

## Create source error object

If a problem occurs during the tokenization request, the [`createSource` ](/commerce-api/resources/reference/digitalriver-object.md#digitalriver-createsource-element-sourcedata)method and [`on source`](/commerce-api/resources/reference/elements.md#source) event returns an error with a `type` and an array of `errors[]`, each containing a detailed `message`.

{% tabs %}
{% tab title="Create Source Error object" %}

```javascript
{
    "type": "bad_request",
    "errors": [{
           "code": "invalid_parameter",
           "parameter": "owner.firstName",
           "message": "'' is not a valid owner.firstname."
    },
    {
            "code": "currency_unsupported",
            "parameter": "currency",
            "message": "currency 'xyz' is not supported."
    }]
}
```

{% endtab %}
{% endtabs %}

## Error types

The following table contains a list of DigitalRiver.js error types.

| Type                    | Description                                                                                                                                                                                                                                                                                             |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bad_request`           | The server could not process the request due to a client error (for example, malformed request syntax). Correct the problem and try again.                                                                                                                                                              |
| `not_found`             | The server can't find the requested resource. No indication is given of whether the condition is temporary or permanent.                                                                                                                                                                                |
| `request_timeout`       | The client did not produce the request within the time that the server was prepared to wait. Resend the request without modifications at any later time.                                                                                                                                                |
| `internal_server_error` | The server encountered an unexpected problem that prevented it from fulfilling the request.                                                                                                                                                                                                             |
| `unauthorized`          | The request requires user authentication. Resend the request with valid user authentication.                                                                                                                                                                                                            |
| `too_many_requests`     | The user sent too many requests in a given amount of time ("rate limiting"). The response should include details explaining the condition and may include a Retry-After header indicating how long to wait before sending a new request.                                                                |
| `conflict`              | <p>There is a request conflict with the current state of the server.</p><p>Conflicts are most likely to occur in response to a PUT request. For example, you may get a 409 response when uploading a file that is older than the one already on the server resulting in a version control conflict.</p> |
| `validation_error`      | <p>Errors triggered by our client-side libraries when failing to validate fields (for example, when a card number or expiration date is invalid or incomplete).</p><p>Used by: DigitalRiver.js</p>                                                                                                      |
| `no_network`            | There is no network coverage or cellular data connection.                                                                                                                                                                                                                                               |

## Error codes

The following table contains a list of DigitalRiver.js error codes.

{% hint style="info" %}
You must only indicate that the payment has been declined, and you must not share the code or descriptions below with the customer.
{% endhint %}

| Code                                       | Description                                                                                                                                                        |
| ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `address_mismatch`                         | There is a problem with your address.                                                                                                                              |
| `invalid_expiration_date`                  | The card is expired, or the expiration date is invalid.                                                                                                            |
| <p></p><p><code>invalid\_format</code></p> | The format of your request is invalid.                                                                                                                             |
| `invalid_parameter`                        | The parameter is invalid. Check the [Commerce API reference](https://docs.digitalriver.com/commerce-api-references/) to see which values are valid and try again.  |
| `invalid_string_empty`                     | The string value is empty. Provide a valid string value and try again.                                                                                             |
| `method_not_allowed`                       | The method is not allowed. Provide a valid method value and try again.                                                                                             |
| `missing_parameter`                        | A parameter is missing. Check the [Commerce API reference](https://docs.digitalriver.com/commerce-api-references/) to see which values are required and try again. |
| `not_found`                                | The item requested was not found.                                                                                                                                  |
| `source_not_found`                         | The source you have requested was not found.                                                                                                                       |
| `unknown_error`                            | An unknown error has occurred.                                                                                                                                     |
