Error 400: Can’t add messages to thread while a run is active

Hi guys, I’m trying to find the best way to handle the case when we are adding a new message to a thread with an active run, and the payload I get is the following:

{
“status”: 400,
“error”: {
“message”: “Can’t add messages to thread_4SDeWVBwqyVnfxcBXFfja74P while a run run_ggjNMB3WBFeL5aLquaxOM1iC is active.”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
},
“code”: null,
“param”: null,
“type”: “invalid_request_error”
}

There isn’t any specific code that lets me know this error is related to this problem, just the message. However, the error message changes and can’t be used as a realiable pattern to handle this case. Since status 400 is generic and also can be triggered by another factors it’s not also reliable to identify and treat this case. I’d like to know how you’ve been dealing with this problem to identify whether the error is actually related to adding a message to a thread with an active run, in order to take actions like adding the messages to a queue to handle them later.