---
title: "EMR_ERROR"
description: "Why requests fail on the EHR vendor side with EMR_ERROR and how to interpret the forwarded status codes."
canonical_url: "https://docs.leyr.io/api/error-handling/emr_error"
---
# EMR_ERROR

> Why requests fail on the EHR vendor side with EMR_ERROR and how to interpret the forwarded status codes.

## Summary

This error occurs when a request fails on the EMR vendor side, despite being correctly formatted from Leyr's perspective. The status codes vary depending on the specific issue, as the error is forwarded directly from the EMR API.

## Example Response

```json
{
    "code": "EMR_ERROR",
    "type": "https://docs.leyr.io/api/error-handling/emr_error",
    "title": "Internal EMR error",
    "status": 401,
    "detail": "{\"statusCode\":401,\"message\":\"Unauthorized: An error occurred while attempting to decode the Jwt: Jwt expired at 2022-07-11T09:47:58Z\"}",
    "instance": "a7dd57f6-7848-4dc5-b9f8-187fb8ec6275"
}
```

## Possible Reasons

- The EMR API returns a bad request response, even though the request is properly structured from Leyr's perspective
- Authorization fails on the EMR side, despite a valid `Authorization` header being passed to Leyr

<u-alert color="primary" variant="subtle">
<template v-slot:description="">

Leyr ensures all requests are properly structured and forwarded to the EMR system.
This error typically indicates that:

- Your request is correctly formatted from Leyr's perspective
- Leyr's communication with the EMR system is functioning properly

In such cases, the error originates from the EMR side and we will have to look into it together to understand the root-cause better.

</template>
</u-alert>

## Troubleshooting Steps

To resolve this error:

1. Examine the `detail` field in the response body. We forward the EMR error message directly, which often contains valuable information about the request issue.
2. Verify you're using the correct values in the `x-leyr-client-id` and `x-leyr-client-secret` headers.
3. Contact our support team at [contact@leyr.io](mailto:contact@leyr.io). As EMR API unification is a core component of our business, we're committed to identifying and resolving any new errors that may arise.


## Sitemap

See the full [sitemap](https://docs.leyr.io/sitemap.md) for all pages.
