Brief:
‘We need an error message when X happens!’
Execution:
Identify the whole action flow, understand the technical infrastructure that causes the error, decide the most suitable design element for the given context, and, if finally is going to be an error message, choose the error format, define the action that triggers it, the copy it will show, the option it will offer, the landing it will provide.