{"record":{"id":"92436722caf80723","repo":"denoland/deno","slug":"unsupported-transport-transport","errorCode":null,"errorMessage":"Unsupported transport: '${transport}'","messagePattern":"Unsupported transport: '(.+?)'","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"ext/net/01_net.js","lineNumber":633,"sourceCode":"    }\n    case \"vsock\": {\n      const { 0: rid, 1: cid, 2: port } = op_net_listen_vsock(\n        args.cid,\n        args.port,\n      );\n      const addr = {\n        transport: \"vsock\",\n        cid,\n        port,\n      };\n      return new Listener(rid, addr, \"vsock\");\n    }\n    case \"tunnel\": {\n      const { 0: rid, 1: addr } = op_net_listen_tunnel();\n      return new Listener(rid, addr, \"tunnel\");\n    }\n    default:\n      throw new TypeError(`Unsupported transport: '${transport}'`);\n  }\n}\n\nfunction validatePort(maybePort, isServer = false) {\n  // A missing port means \"any available port\" (port 0) for servers. Clients\n  // must always specify a port to connect to, so a missing port is left as-is\n  // and rejected below.\n  if (isServer && (maybePort === null || maybePort === undefined)) {\n    maybePort = 0;\n  }\n  if (typeof maybePort !== \"number\" && typeof maybePort !== \"string\") {\n    throw new TypeError(`Invalid port (expected number): ${maybePort}`);\n  }\n  if (maybePort === \"\") throw new TypeError(\"Invalid port: ''\");\n  const port = Number(maybePort);\n  if (!NumberIsInteger(port)) {\n    if (NumberIsNaN(port) && !NumberIsNaN(maybePort)) {\n      throw new TypeError(`Invalid port: '${maybePort}'`);","sourceCodeStart":615,"sourceCodeEnd":651,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/net/01_net.js#L615-L651","documentation":"Deno.listen() dispatches on args.transport (defaulting to \"tcp\") and recognizes exactly tcp, unix, vsock and tunnel in this build; every other value reaches the default case and throws TypeError(`Unsupported transport: '<transport>'`). Notably udp is NOT a listen() transport here — datagram sockets use Deno.listenDatagram — and there is no \"tls\" listener transport; TLS is per-connection (Deno.connectTls / Deno.startTls).","triggerScenarios":"`Deno.listen({ transport: \"udp\", port: 53 })`; `Deno.listen({ transport: \"tls\", port: 443 })`; casing or typo errors like \"TCP\"/\"ip\"; a transport string sourced from config or cross-runtime code written against Node's vocabulary (dgram, tls).","commonSituations":"Assuming listen({transport:\"udp\"}) from older documentation — UDP moved to Deno.listenDatagram; expecting a TLS listener API similar to Node's tls.createServer; polyfills or shared code paths that pass Node transport names; vsock/tunnel unavailable on older Deno versions.","solutions":["For TCP, omit transport or pass \"tcp\".","For UDP, use Deno.listenDatagram({ transport: \"udp\", port }) or { transport: \"unixpacket\", path }.","For TLS servers, listen on tcp and terminate TLS per connection (Deno.startTls / connectTls on the client side) — there is no listen({transport:\"tls\"}).","Check your Deno version's docs for vsock and tunnel availability before using them."],"exampleFix":"// before\nconst sock = Deno.listen({ transport: \"udp\", port: 53 }); // Unsupported transport: 'udp'\n\n// after\nconst sock = Deno.listenDatagram({ transport: \"udp\", port: 53 });","handlingStrategy":"validation","validationCode":"const LISTEN_TRANSPORTS = new Set([\"tcp\", \"unix\", \"vsock\", \"tunnel\"]);\nfunction openListener(args: { transport?: string; [k: string]: unknown }) {\n  const t = args.transport ?? \"tcp\";\n  if (!LISTEN_TRANSPORTS.has(t)) {\n    throw new TypeError(\n      `unsupported listen transport '${t}'; use Deno.listenDatagram for udp, tcp has no 'tls' transport`,\n    );\n  }\n  return Deno.listen(args as Parameters<typeof Deno.listen>[0]);\n}","typeGuard":"const isListenTransport = (t: unknown): t is \"tcp\" | \"unix\" | \"vsock\" | \"tunnel\" =>\n  t === \"tcp\" || t === \"unix\" || t === \"vsock\" || t === \"tunnel\";","tryCatchPattern":null,"preventionTips":["UDP belongs to Deno.listenDatagram, not Deno.listen","There is no listen({transport:\"tls\"}) — terminate TLS per connection","Validate transport strings from config against a whitelist before calling listen"],"tags":["deno","net","listen","transport","udp","tls"],"backgroundTag":"unsupported-transport","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}