You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"On error, err is an Error object, where err.code is the error code. Keep in mind that err.code will be set to 'ENOENT' not only when the hostname does not exist but also when the lookup fails in other ways such as no available file descriptors."
I'm certainly getting ENOTFOUND locally when dns.lookup() fails to find an address. And it's also what I get for valid names if I set ulimit -n sufficiently low. So it sure seems to be the case that ENOTFOUND might sometimes mean "no available file descriptors" (or at least something that isn't actually "address not found") in this case, which is really unfortunate IMO. EDIT: I'm on macOS, just in case this is platform-dependent behavior.
Activity
Trott commentedon May 8, 2019
I'm certainly getting
ENOTFOUNDlocally whendns.lookup()fails to find an address. And it's also what I get for valid names if I setulimit -nsufficiently low. So it sure seems to be the case thatENOTFOUNDmight sometimes mean "no available file descriptors" (or at least something that isn't actually "address not found") in this case, which is really unfortunate IMO. EDIT: I'm on macOS, just in case this is platform-dependent behavior.sagitsofan commentedon May 9, 2019
It seems that
dns.lookup()will always returnENOTFOUNDon a empty lookup or when the host not found.https://github.com/nodejs/node/blob/master/lib/internal/errors.js#L503
Should we change the error code or fixed the documentation?
Trott commentedon May 13, 2019
Fixed in fd8d5e7
doc: dns.lookup() documentation error code
doc: dns.lookup() documentation error code