denoland/deno · error · TypeError
Invalid port: ''
Error message
Invalid port: ''
What it means
Error "Invalid port: ''" thrown in denoland/deno.
Source
Thrown at ext/net/01_net.js:647
const { 0: rid, 1: addr } = op_net_listen_tunnel();
return new Listener(rid, addr, "tunnel");
}
default:
throw new TypeError(`Unsupported transport: '${transport}'`);
}
}
function validatePort(maybePort, isServer = false) {
// A missing port means "any available port" (port 0) for servers. Clients
// must always specify a port to connect to, so a missing port is left as-is
// and rejected below.
if (isServer && (maybePort === null || maybePort === undefined)) {
maybePort = 0;
}
if (typeof maybePort !== "number" && typeof maybePort !== "string") {
throw new TypeError(`Invalid port (expected number): ${maybePort}`);
}
if (maybePort === "") throw new TypeError("Invalid port: ''");
const port = Number(maybePort);
if (!NumberIsInteger(port)) {
if (NumberIsNaN(port) && !NumberIsNaN(maybePort)) {
throw new TypeError(`Invalid port: '${maybePort}'`);
} else {
throw new TypeError(`Invalid port: ${maybePort}`);
}
} else if (port < (isServer ? 0 : 1) || port > 65535) {
// Servers may bind to port 0 (OS-assigned), clients may not connect to it.
throw new RangeError(`Invalid port (out of range): ${maybePort}`);
}
return port;
}
function createListenDatagram(udpOpFn, unixOpFn) {
return function listenDatagram(args) {
switch (args.transport) {
case "udp": {View on GitHub (pinned to 89f33cbef2)
When it happens
Trigger: Thrown at ext/net/01_net.js:647 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/0928a6e5d265919f.
Report an issue: GitHub.