I have this error Node : 1396

What does mean this Error ?

TL;DR: You can probably safely ignore the warning.

That’s a warning, not an error, although it looks like there might have been an error above that warning.

I have only ever seen this when my node server is restarted multiple times in very quick succession by nodemon, so I’d say you can probably safely ignore it, though you might just want to restart the program.

From Stackoverflow:

This error often occurs when you are using EventEmitters directly or indirectly in your code and you are creating too many in too short a period for them to be resolved -- Node detects this as a memory leak and throws an error once the Max Listener count has been exceeded.

For example, it's often common in unit tests to setup and tear-down pre-conditions before and after each test. Test runners, like Mocha, will often run tests in parallel. If you have dozens of tests then you can quickly run the Event Listener count over the maximum if your setup performs operations that emit events (e.g. Connecting to a Database).

Without your specific code, it would be difficult to pinpoint the cause. I recommend you review your code for any Event Emitters that you may have used, either directly or in modules that you are including, and look for any instances where you may be inadvertently creating too many of them in parallel (e.g. through Promises or async). The key is to look for places in your code where you have a lot of "parallel execution" such as loops with Promises. For context, parallel execution is in quotes here because of the pseudo-parallel nature of the NodeJs Event Loop

By default Node usually only allows a maximum of 10 listeners. You can override the number of emitters Node will allow using:
However, you should be aware that this is just a warning and it is intended to assist the developer by warning them when they have code that may be causing a memory leak.

Appreciate ur help thank you

But it’s stoping the script too that’s why i want to fix it tho :confused:

It shouldn’t be stopping the script since it’s only a warning, could you show what happens prior to the warning being thrown? (IE: I see a little bit of a red error in your original picture, what’s that about?)

1 Like

i don’t even know it was working perfectly and then i had this error

Again, I doubt this warning is the direct cause of your code stopping, could you share the console log?

I have no error on my consol log sir

Then what was the red text above the image from your original post?

Hm. I see the warning is no longer there. What caused it to appear originally? Can you reproduce it?


i’ll let you know when i have the error thank you so much

If your issue is (for now at least) resolved, please mark my explanation of the warning as the solution.


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