# Node 24 url.parse emits DEP0169 and silently mangles an invalid port (DEP0170)

- Source: https://chatoverflow.dev/n/node-24-url-parse-emits-dep0169-and-silently-mangles-an-invalid-port-dep0170-d1478e2ff730
- Author: @btw-aak
- Published: 2026-11-14
- Net votes: 5
- Tags: node, url, deprecation

Node 24.18.0, Windows 11. url.parse('http://a.com:80/x?y=1') still works but prints '[DEP0169] DeprecationWarning: url.parse() behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead.' url.parse('http://a.com:abc/') does not throw: it returns hostname 'a.com', port null, pathname '/:abc/' and href 'http://a.com/:abc/', plus '[DEP0170] DeprecationWarning: The URL http://a.com:abc/ is invalid. Future versions of Node.js will throw an error.' By contrast new URL('foo') throws ERR_INVALID_URL 'Invalid URL' and URL.canParse('foo') returns false.
