# Error Responses

ESS follows the [**RFC 9110 HTTP response status codes**](https://datatracker.ietf.org/doc/html/rfc9110.html#name-status-codes) standard:

| 100 - 199     | Associated with Informational responses. |
| ------------- | ---------------------------------------- |
| 200 - 299     | Associated with Successful responses.    |
| 300 - 399     | Associated with Redirection responses.   |
| **400 – 499** | Associated Client Error responses.       |
| **500 - 599** | Associated with Server Error responses.  |

Per the RFC, error responses have status codes **400-599** (inclusive).

## Error Response and Format

### Error Response Fields

{% hint style="info" %}
Changed in version 2.3.0.
{% endhint %}

Starting in version 2.3, ESS services can provide more information when returning HTTP errors (i.e., HTTP status codes **400-599** ). Specifically, all ESS services follow [**RFC 9457 (Problem Details for HTTP APIs)**](https://datatracker.ietf.org/doc/html/rfc9457.html) . That is, all ESS services may include the fields specified in [**RFC 9457**](https://datatracker.ietf.org/doc/html/rfc9457.html#name-members-of-a-problem-detail) to provide more information:

```json
{
  "status": <status code>,
  "title":  "<summary>",
  "detail": "<additional description/details of the error>",
  "instance": "<OpenTelemetry Span Id>"
}
```

| **`status`**   | [**RFC 9110 HTTP status codes**](https://datatracker.ietf.org/doc/html/rfc9110.html#name-status-codes). |
| -------------- | ------------------------------------------------------------------------------------------------------- |
| **`title`**    | Corresponding summary of the problem type.                                                              |
| **`detail`**   | Additional details of the error.                                                                        |
| **`instance`** | [OpenTelemetry Span Id](https://docs.inrupt.com/ess/2.3/reference/appendix-opentelemetry).              |

For example:

```json
{
  "status": 400,
  "title": "Bad Request",
  "detail": "Verifiable Credential does not match any configured shape",
  "instance": "a96e351460518c83"
}
```

For UMA and OIDC Broker services, they continue, as in earlier versions, to follow [**RFC 6749 (OAuth 2.0)**](https://datatracker.ietf.org/doc/html/rfc6749.html#section-5.2), and the new [**RFC 9457**](https://datatracker.ietf.org/doc/html/rfc9457.html) fields are added to their error response.

<pre class="language-none"><code class="lang-none">
{
<strong>   "status": &#x3C;status code>,
</strong><strong>   "title":  "&#x3C;summary>",
</strong><strong>   "detail": "&#x3C;additional description/details of the error>",
</strong><strong>   "instance": "&#x3C;OpenTelemetry Span Id>",
</strong><strong>   "error": "&#x3C;error code per RFC6749>",
</strong>   "error_description": "&#x3C;optional error description  per RFC6749>",
   // ...
}
</code></pre>

For example:

```json
{
  "status": 400,
  "title": "Bad Request",
  "detail": "Invalid DPoP in ID token.",
  "instance": "0e4e8d02a4597c57",
  "error": "request_denied",
  "error_description":"Invalid DPoP in ID token."
}
```

You can correlate by the span ID **if** that particular span (unit of work) emits a log record. For more information on ESS’ support of OpenTelemetry, see [Appendix: OpenTelemetry](https://docs.inrupt.com/ess/2.3/reference/appendix-opentelemetry) .

### Error Response Format

* For UMA and OIDC Broker services, [**RFC 6749**](https://datatracker.ietf.org/doc/html/rfc6749.html) takes precedence over [**RFC 9457**](https://datatracker.ietf.org/doc/html/rfc9457.html) , and as such, the error responses return as **`application/json`** media type.
* For all other services following [**RFC 9457**](https://datatracker.ietf.org/doc/html/rfc9457.html) , the error responses return as as **`application/problem+json`** media type.

{% hint style="info" %}
**Error Pages**\
For error responses to browser requests, the error pages ( **`text/html`** media type) returned by ESS display the new information.
{% endhint %}
