---
title: Set Error Details node
description: The Set Error Details node adds details to the JSON response when a journey ends in an error. You can configure the node properties to:
component: auth-node-ref
version: latest
page_id: auth-node-ref::set-error-details
canonical_url: https://docs.pingidentity.com/auth-node-ref/latest/set-error-details.html
keywords: ["Nodes &amp; Trees", "Journeys", "Authentication"]
superseded_by: https://docs.pingidentity.com/auth-node-ref/latest/set-error-details.html
section_ids:
  examples: Examples
  example_1_handle_identity_assertion_errors: "Example 1: Handle identity assertion errors"
  example_2_set_custom_response_headers: "Example 2: Set custom response headers"
  availability: Availability
  inputs: Inputs
  dependencies: Dependencies
  configuration: Configuration
  outputs: Outputs
  callbacks: Callbacks
  outcomes: Outcomes
  errors: Errors
---

# Set Error Details node

The Set Error Details node adds details to the JSON response when a journey ends in an error. You can configure the node properties to:

* Return an error message.

* Include extra information in the response body in the form of static `key:value` fields.

* Set custom response headers.

  You can't modify the protected HTTP headers, nor can you modify the session cookie or load balancer cookie using the `Set-Cookie` header.

  > **Collapse: Protected HTTP headers**
  >
  > * `X-Frame-Options`
  >
  > * `X-Content-Type-Options`
  >
  > * `Cache-Control`
  >
  > * `Content-API-Version`
  >
  > * `Expires`
  >
  > * `Pragma`
  >
  > * `Content-Type`
  >
  > * `Content-Length`
  >
  > * `Date`
  >
  > * `Keep-Alive`
  >
  > * `Connection`
  >
  > * `Transfer-Encoding`
  >
  > * `Server`
  >
  > * `Trailer`
  >
  > * `Upgrade`

Place the Set Error Details node before the node that errors in the journey.

## Examples

### Example 1: Handle identity assertion errors

This example uses the Set Error Details node to handle errors from the [Identity Assertion node](identity-assertion-node.html) when the journey ends in an error.

![set error details journey](_images/set-error-details-journey.png)

* The Set Error Details node adds details to the JSON response when the journey ends in an error. This example uses the following configuration:

  * Error Message

    * Key: `en-gb`

    * Value: `Identity assertion failure`

  * Error Details

    * Key: `errorUrl`

    * Value: `https://example.com/error`

* The Identity Assertion node is configured as described in the [documentation](identity-assertion-node.html).

  If an error is encountered, the Set Error Details node displays the configured message to the user and adds both the message and the details to the JSON response.

  For example:

  ```json
  {
      "code": 401,
      "reason": "Unauthorized",
      "message": "Identity assertion failure",
      "detail": {
        "errorUrl": "https://example.com/error"
      }
  }
  ```

### Example 2: Set custom response headers

This example uses the Set Error Details node to set a `Custom-Error` response header when the journey ends in an error. This header could be read by a custom UI or a legacy application to trigger a specific action when an error is encountered.

To simulate an error for demonstration purposes, this simple login journey includes a script that errors.

![Journey with a Set Error Details node setting a response header](_images/set-error-details-header-journey.png)

* The [Page node](page.html) containing the [Platform Username node](platform-username.html) and [Platform Password node](platform-password.html) prompts for credentials.

* The [Data Store Decision node](data-store-decision.html) validates the username-password credentials.

* The Set Error Details node sets the response header when the journey ends in an error. This example uses the following configuration:

  * Response Headers

    Key: `Custom-Error`

    Value: `error-encountered`

* The [Scripted Decision node](scripted-decision.html) calls the following script, which expects an outcome of `next` but the node is configured with an outcome of `true`:

  ```javascript
  action.goTo("next");
  ```

  When the script runs, the journeys ends in an error because the `next` outcome doesn't exist. The Set Error Details node sets the configured response header.

Follow these steps to try the example:

1. Create the example journey using the journey editor.

2. Authenticate a test user with the journey. Make sure you include the `--show-headers` option (or `--include` in older `curl` versions) to return the response headers:

   ```bash
   $ curl --show-headers \
   --request POST \
   --header 'X-OpenAM-Username: bjensen' \
   --header 'X-OpenAM-Password: Ch4ng3it!' \
   --header "Accept-API-Version: resource=2.1, protocol=1.0" \
   "https://tenant-env-fqdn/am/json/realms/root/realms/alpha/authenticate?authIndexType=service&authIndexValue=myJourney"

   HTTP/1.1 401
   X-Frame-Options: SAMEORIGIN
   X-Content-Type-Options: nosniff
   ...
   Custom-Error: error-encountered
   ...

   {
       "code":401,
       "reason":"Unauthorized",
       "message":"Login failure"
   }
   ```

## Availability

| Product                               | Available? |
| ------------------------------------- | ---------- |
| PingOne Advanced Identity Cloud       | Yes        |
| PingAM (self-managed)                 | Yes        |
| Ping Identity Platform (self-managed) | Yes        |

## Inputs

None. This node doesn't read shared state data.

## Dependencies

This node has no dependencies.

## Configuration

| Property         | Usage                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Error Message    | The message to add to the JSON response when a journey ends in an error.Add a custom, localized message per locale:1) Click [icon: plus, set=fa].

2) In the Key field, enter the locale. For example, `en-gb`.[1](#locale-footnote)

3) In the Value field, enter the message. For example, `Invalid outcome from script`.

4) Click Done.

5) Repeat to add more messages and save your changes when you're done.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Error Details    | The details to add to the JSON response when a journey ends in an error:1) Click [icon: plus, set=fa].

2) In the Key field, enter a name to identify the details. For example, `redirect_url`.

3) In the Value field, enter the details to return. For example, `https://example.com`.

   The value can be a simple text string, a boolean value, or a JSON formatted value. The value is formatted appropriately when output in the JSON response.

   For example:

   Key	Value	Output&#xA;&#xA;example&#xA;&#xA;&#x9;&#xA;&#xA;this is a test value&#xA;&#xA;&#x9;&#xA;"example": "this is a test value"&#xA;&#xA;&#xA;&#xA;boolean&#xA;&#xA;&#x9;&#xA;&#xA;true&#xA;&#xA;&#x9;&#xA;"boolean": true&#xA;&#xA;&#xA;&#xA;field&#xA;&#xA;&#x9;&#xA;&#xA;{ "nested": "nested value" }&#xA;&#xA;&#x9;&#xA;"field": {&#xA;   "nested": "nested value"&#xA;}

4) Click Done.

5) Click [icon: plus, set=fa]Add to repeat and add more details.

6) Save your changes. |
| Response Headers | The response headers to set:- To add a response header:

  1. Click [icon: plus, set=fa]Add in the Response Headers modal.

  2. Enter the HTTP header name to display in the Key field and the corresponding value to display in the Value field.

  3. Click Done.

- To edit a response header:

  1. Click the Pencil icon ([icon: pencil-alt, set=fa]).

  2. Update the Key and Value as when adding headers.

- To remove a response header, click the Delete icon ([icon: trash, set=fa]).When finished, click Save to keep your settings.                                                                                                                                                                                                                                                                                                                                                                                                                    |

(1) Specify a [locale that Java supports](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Locale.html), such as `en-gb`. Otherwise, the node throws a configuration exception with an `Invalid locale provided` message.

## Outputs

This node doesn't change the shared state.

## Callbacks

This node doesn't send any callbacks.

## Outcomes

Single outcome path: when the journey ends in an error, this node adds the configured details to the JSON response.

## Errors

This node doesn't log any error or warning messages of its own.
