Open AI Assistant API returning inconsistent response

Hi all I am facing a strange issue ,I am trying 1 example of creating a chatbot which will generate question regarding birth state of US President and it will let me know if my answer is correct.
Here for the same code 1 time I am getting correct answer and the another its returning me the question only and no response is the in the message list ,can you pls help here what could be the issue ,Has any1 faced this kind of issue?