Lingering text in text completion API response

I made a small project on SMS using twilio serverless backend, and making api calls to chatGPT. Every once in a while the response starts with a few random words (still related to the overall theme) before the actual response. The responses I expect typically start with a greeting like “Dear xyz,…” and most of the time it works but every once in a while, I see a few words at the beginning. Not sure how to debug.

Welcome to our dev community.

What’s your prompt look like? Any extra spaces or newlines at the end of it occasionally?

I’m asking a few questions to the user to create a “thank you” note, and my prompt is:
Please create a thank you note for someone in my life. Keep it short and informal. Use the following questions and my answers to make it personal: 1. Can you think of someone who has made a positive impact on your life, whether it’s through their support, kindness, or just presence? It could be a friend, family member, teacher, or even a colleague.: [user response] 2. What do you call them?: [user response] 3. Can you share a specific moment…” I’ve like 5 questions and user’s responses. User’s responses are escaped for special characters.