High amount of credits spent on error outputs

Sometimes i get an error message saying that there was an error generating the output and when i get these messages is when it spends the highest amount of credits, when i leave the chat and come back, the input that causes the error output and the error output itself disappear, but the credits are being spent anyways.
It’s a very frustrating issue sometimes and it doesn’t allow me to continue sending messages until i leave the chat, comeback, and it disappeared.
Does anyone else has a similar issue? is there a way to prevent this from happening?