# 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](/ess/2.4/reference/appendix-opentelemetry.md).                                  |

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](/ess/2.4/reference/appendix-opentelemetry.md) .

### 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inrupt.com/ess/2.4/reference/error-responses.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
