OpenAI GPT (error 400) - Can't solve

I am receiving the classic HTTP 400 error “we cannot parse the json body of your request…”. The reason why this is so frustrating - my chatbot works fine 90% of the time.

I seem to only receive this error when the chatbot isn’t ready for another payload (i.e. when the chatbot doesn’t ask a question). I have tried everything from changing the prompt, ensuring proper json safe formatting, etc. I’ll include the circumstance where it occurs, my JSON and workflow. This is ruining my ability to monetize my application. Any insight would be greatly appreciated:

Your prompt structure is malformed. In the API connecter, you want "content": <prompt>. <prompt> should be a text:formatted as JSON safe. In your case that’d be Arbitrary text:formatted as JSON-safe with the knowledge base, system prompt, and company dynamic data in the dynamic text. Your API call will break every time there’s a quotation mark or new line. You’re not using the correct formatting for chat - you’re sending the chat history after the user’s message, which will lead to worse responses.

thank you for the response! How can I fix my chat formatting in a way that it doesnt break? ANy chance you can take a look at my app here: leadcave | Bubble Editor

the workflow is under page “chat”