<@U04UQ68083H> Can i overwrite error message of kr...
# ory-copilot
f
@chilly-king-10285 Can i overwrite error message of kratos?
c
A message from kapa.ai
Yes, you can customize the error messages in Ory Kratos. When building a single page app, or a native app, Ory Identities will respond with errors in some cases. The error messages are structured as follows:
Copy code
json {    id: 1234,    text: "Some default text",    context: {},   }
The
id
is a unique, fixed number that will not change and can be used to translate the message or use your own message content. The
text
is a default text in English that you can display if you do not want to customize the message. The
context
is a JSON object which may contain additional fields such as
expires_at
. This is helpful if you want to craft your own messages. You can find an exemplary error handling logic in the [React.js reference implementation](https://github.com/ory/kratos-react-nextjs-ui/blob/master/pkg/errors.tsx). Additionally, Ory Kratos allows you to implement the error page in any way you want. When a user-facing error occurs, Ory Kratos will store the error message and context and redirect the User's Browser to the Error UI URL set by the
selfservice.flows.error.ui_url
configuration or
SELFSERVICE_FLOWS_ERROR_UI_URL
environment variable. For more details, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration).