# Global and default error handlers

*MuleSoft Developer Study Guide · Handling Errors · Last updated October 28, 2026 · https://www.certifyforce.com/study-guide/mulesoft-developer/handling-errors/global-and-default-error-handlers*

How Mule 4 handles a messaging error when nothing is configured, how to define a named global Error Handler and attach it with error-handler ref or the defaultErrorHandler-ref global configuration, and how to reuse a single named On-Error component with on-error ref.

- Certification: Salesforce MuleSoft Developer
- Exam section: Handling Errors
- Study guide: https://www.certifyforce.com/study-guide/mulesoft-developer

**Official exam objective:**

> Apply correct processors/syntax to implement global error handlers, and predict outcomes.

## What the exam expects

- Predict what a caller receives when a flow fails and no error handling is configured (the default handling).
- Write the XML that defines a named global Error Handler and attaches it to chosen flows with `<error-handler ref="..."/>`.
- Make one global Error Handler the application default with a `<configuration defaultErrorHandler-ref="..."/>` global element, and predict which handler runs when a flow also declares its own.
- Reuse one named On-Error component inside several Error Handlers with `<on-error ref="..."/>`.
- Reject configurations that do nothing: a handler that is defined but never referenced, a handler called with Flow Reference, or a handler put in a subflow.

Key terms:
- **Error Handler** (`<error-handler>`): the container that routes an error to the first matching On-Error component; built into every flow and Try scope, or defined globally with a `name`.
- **Global Error Handler**: an `<error-handler name="...">` defined at the root of a configuration file, outside any flow.
- **Default error handler**: the handler named by `defaultErrorHandler-ref` on the `<configuration>` global element.
- **On-Error component**: On Error Continue or On Error Propagate, the scopes that hold the processors that run for a matched error.

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Unhandled messaging error | Logged and propagated by the default handler (`OnErrorPropagateHandler`) | [Error Handlers](https://docs.mulesoft.com/mule-runtime/latest/error-handling) |
| HTTP Listener default responses | Success: 200 with the payload; failure: 500 with the error description | [Configure HTTP Listener Source](https://docs.mulesoft.com/http-connector/latest/http-listener-ref) |
| Reference a global handler from a flow | `<error-handler ref="name"/>` inside the flow (XML-only) | [Error Handlers](https://docs.mulesoft.com/mule-runtime/latest/error-handling) |
| Set the app default | `<configuration defaultErrorHandler-ref="name"/>`; optional, default none | [Global Configurations](https://docs.mulesoft.com/mule-runtime/latest/global-settings-configuration) |
| What `defaultErrorHandler-ref` may point at | Must be a reference to a global error handler | [Global Configurations](https://docs.mulesoft.com/mule-runtime/latest/global-settings-configuration) |
| Studio path for the default | Global Elements > Create > Global Configuration > Configuration > Default Error Handler | [Error Handlers](https://docs.mulesoft.com/mule-runtime/latest/error-handling) |
| Reuse one On-Error component | `<on-error ref="name"/>` inside an `<error-handler>` | [On-Error Components](https://docs.mulesoft.com/mule-runtime/latest/on-error-scope-concept) |
| Who can reference a global handler | Flows and Try scopes | [On-Error Components](https://docs.mulesoft.com/mule-runtime/latest/on-error-scope-concept) |
| Subflows | No built-in error handling; use a Try scope inside | [Flow and Subflow Scopes](https://docs.mulesoft.com/mule-runtime/latest/flow-component) |
| Flow handler versus default | Exam convention: a flow's own handler wins; the default is for flows with none | [Global Configurations](https://docs.mulesoft.com/mule-runtime/latest/global-settings-configuration) |

## Check yourself

- What does a client calling an HTTP Listener flow receive when the flow fails and no error handling is configured?
- Why does the Studio console show an `OnErrorPropagateHandler` entry for a flow that has no Error Handler at all?
- What may `defaultErrorHandler-ref` point at, and what is its default?
- Why can no global or flow-level On-Error component handle an error of the `CRITICAL` type?

## Sources

- [Error Handlers](https://docs.mulesoft.com/mule-runtime/latest/error-handling)
- [Global Configurations](https://docs.mulesoft.com/mule-runtime/latest/global-settings-configuration)
- [On-Error Components](https://docs.mulesoft.com/mule-runtime/latest/on-error-scope-concept)
- [Global Elements](https://docs.mulesoft.com/mule-runtime/latest/global-elements)
- [Configure HTTP Listener Source](https://docs.mulesoft.com/http-connector/latest/http-listener-ref)
- [Flow and Subflow Scopes](https://docs.mulesoft.com/mule-runtime/latest/flow-component)
- [Mule Errors](https://docs.mulesoft.com/mule-runtime/latest/mule-error-concept)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 5 linked practice questions, and unlimited timed mock exams are included with the MuleSoft Developer pack (USD $19): https://www.certifyforce.com/practice-exams
