Chat Bot not Connecting

I get this error message [11:54] error: Reconnecting in 2 seconds..(node:3302) UnhandledPromiseRejectio - for the new chat bot I started coding using the tutorial at Chat & Chatbots | Twitch Developers Anyone knows what I could try to fix it?

So far, I tried resetting the oauth token and use a new one and restarting the bot after, but I get the exact same error again. I also went back to the original tutorial’s code to make sure it was not the code I had added.

I am using the exact same code as the linked tutorial. It worked at first then stopped working after my first tests and even after going back to the same code as in the tutorial linked above.

I also tried again after 30 minutes to see if the bot got timed out for too many messages, and still the exact same error.

As the error you logged mentions, you aren’t catching the actual error that’s causing the issue so there’s no way for us to know what is at fault, and without seeing your code there’s now much we can do to help as we don’t know what library you’re using to connect to chat or how you are connecting.


I am using the exact code at

as linked in my original post.

That is just a sample code, and isn’t meant for production. You have to catch the errors and put in error detection like Dist said in order to narrow down where the error came from. Node throws all uncaught errors generically so you can’t really determine what happened.

Thank you both. I will try try/catch blocks and see what that gives.

I added a .catch in this version of the tutorial’s code:

and still just get “Unable to connect” as a reply. I double-checked the token was good and my bot didn’t get autobanned from my chat. What are common things to check for and other options to get more informative messages out of that error? Also, is there a way to know if my bot got generally blocked from the API?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.