Error: Discord API call failed: read ECONNRESET
So, I am making a FiveM server and I have a discord.js bot. The bot is supposed to:
- Detect when there is a new role assigned to a user
- Then assign the corresponding group (in game version of the role with the in game permissions etc) by grabbing their discord user id from the database
However as the title suggests, that is one of the many many errors it is returning. I have heard all over the place that it is network connection which it very well may be but I am coming here for more advice and guidance. I am not a FiveM developer nor do I have much experience with code so any responses or help will need to be dumbed down.
Here is a screenshot of a few debugs I added in to try help troubleshoot the problem and what the console returns (see attached image)
What is baffling me is it does not look like there is a problem with the code whatsoever. I have the [Founder] role activated in my discord server but it does not read the staff level.

7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!that is indeed a network issue
As to what those other errors are, without any code its impossible to tell
I have ran all of the code through Cursor AI (I know absolutely criminal to developers) but the code looks absolutely fine. It was all working fine this morning in the AMs. I have just moved house and our new wifi is absolutely terrible, I’ll try at night to see if it works.
ai causes more problems than it solves because it uses outdated data
but the first issue you need to tackle is your connection indeed
Well I didn’t fix any code with AI i just attempted to troubleshoot it with the AI, it didn’t change anything it just gave me a list of things it could be like my bot token which was fine because I ran a debug and well as you can see in the photo it works. So only thing I can think of is my wifi as it’s so bad I can hardly start up my server and search something up on Opera at the same time lol
Ya, DiscordJS is a Websocket based library...which needs a pretty reliable contention to Discord to effectively operate. WiFi in general is probably not a great idea for it, let alone a slow and unstable connection via WiFi
Well it is just a localhost as it’s still in development but my Dev is on holiday and i’ve been left with the code. Everything in the server bar the bot works pretty much fine other than the chat which is a me skill issue.