<@U04UQ68083H> when receiving an api error where t...
# ory-copilot
i
@chilly-king-10285 when receiving an api error where the response data contains UiNode elements in which cases can it happen that I have multiple field error-messages within these nodes? until now I have never seen that the response contained more than one message of type error
b
A message from kapa.ai
Based on the provided knowledge sources, I can offer some insight into error handling in Ory Kratos, particularly regarding UI nodes and error messages. However, the specific scenario you're asking about - multiple field error messages within a single UI node - is not explicitly covered in the given information. The [Error handling documentation](https://www.ory.sh/docs/kratos/bring-your-own-ui/custom-ui-basic-integration#error-handling) shows that errors can occur at different levels: 1. Method level errors 2. Field level errors 3. Request level errors For field level errors, the documentation shows how to iterate through UI nodes and their messages:
Copy code
typescript err.response?.data?.ui.nodes.forEach(({ messages }) => {   // messages is an array of error messages   messages.forEach((message) => {     console.log(message)   }) })
This code suggests that each UI node can have multiple messages. However, the documentation doesn't explicitly state whether these messages can be of different types or if multiple error messages can occur for a single field. The [UI message codes documentation](https://www.ory.sh/docs/kratos/concepts/ui-user-interface#ui-message-codes) shows that each message has a specific format, including an ID, text, type (usually "error" or "info"), and context. This suggests that different types of messages can exist, but it doesn't confirm whether multiple error messages can occur for a single field. Given the information available, I can't definitively answer whether multiple field error messages can occur within a single UI node. If you haven't encountered this scenario in practice, it's possible that it's not a common occurrence or may not be supported by the current implementation. For a more definitive answer, you might need to consult additional Ory documentation or reach out to Ory support for clarification on this specific scenario.