Most of the time that people search in the internet, they look for an error message, so is expected that to help SEO we should add the error message in the title. Is a good behavior?
The thing that you are asking about should go in the title. If you're asking how to resolve an error message, the error message should go in the title.
There's nothing more frustrating than getting a google match on a Stack Exchange question for "How do I foo the bar?" only to find that the question isn't about how to foo the bar at all, but how to fix some obscure error message.