When designing an error message ask yourself:
Does the user need to be interrupted to read this message?
If so consider putting the error in a modal.
If not, don't use a modal.