{"record":{"id":"86e432c0f6a3524e","repo":"denoland/deno","slug":"e-message-86e432","errorCode":null,"errorMessage":"e.message","messagePattern":"e\\.message","errorType":"exception","errorClass":"WebTransportError","httpStatus":null,"severity":"error","filePath":"ext/web/webtransport.js","lineNumber":273,"sourceCode":"        this.#headerUni = concat(encodeVarint(UNI_WEBTRANSPORT), sessionIdBuf);\n\n        this.#settingsTx = settingsTx;\n        this.#settingsRx = settingsRx;\n        this.#connect = connect;\n\n        this.#reliability = \"supports-unreliable\";\n\n        return { conn, sessionId, sessionIdBuf };\n      },\n    );\n\n    this.#promise = promise;\n    this.#datagrams = new WebTransportDatagramDuplexStream(\n      illegalConstructorKey,\n      promise,\n    );\n    this.#ready = PromisePrototypeThen(promise, () => undefined, (e) => {\n      throw new WebTransportError(e.message);\n    });\n  }\n\n  getStats() {\n    webidl.assertBranded(this, WebTransportPrototype);\n    return PromiseResolve({\n      bytesSent: 0,\n      packetsSent: 0,\n      bytesLost: 0,\n      packetsLost: 0,\n      bytesReceived: 0,\n      packetsReceived: 0,\n      smoothedRtt: 0,\n      rttVariation: 0,\n      minRtt: 0,\n      estimatedSendRate: null,\n      atSendCapacity: false,\n    });","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/ext/web/webtransport.js#L255-L291","documentation":"This is the rejection path for WebTransport's connection promise: the underlying connect op failed, and ext/web/webtransport.js maps the op error's message into a WebTransportError (a DOMException subclass) exposed via the session's `ready` promise and any first use of the session (opening streams, datagrams). Common underlying causes: the server does not speak HTTP/3 WebTransport, TLS/certificate failure, or network unreachability. The message text is whatever the transport op reported (shown here as the generic placeholder 'e.message').","triggerScenarios":"Awaiting `wt.ready` or `wt.datagrams.writable.ready` on a server without WebTransport support; connecting to an HTTP/2-only or plain-TCP endpoint; self-signed certificates; connecting to a host that is down — the constructor succeeds and the failure surfaces asynchronously here.","commonSituations":"Local dev servers without HTTP/3; proxies/load balancers stripping HTTP/3 or ALT-SVC; expired/self-signed certs in test environments; wrong port (WebTransport runs over QUIC/UDP, typically 443).","solutions":["Catch rejections: `await wt.ready.catch((e) => ...)` and inspect e.message / e.source for the real cause.","Verify the endpoint advertises HTTP/3 (Alt-Svc / QUIC on UDP 443) and supports WebTransport.","For local TLS testing, use a trusted cert (mkcert) rather than self-signed, or pass serverCertificateHashes options.","Confirm the URL uses https:// and the correct port, and that UDP/QUIC is not blocked by a firewall."],"exampleFix":"// before\nconst wt = new WebTransport(url);\nawait wt.ready; // unhandled WebTransportError\n\n// after\nconst wt = new WebTransport(url);\ntry {\n  await wt.ready;\n} catch (e) {\n  console.error(\"connect failed:\", e.message);\n  return;\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isWebTransportError(e) {\n  return e instanceof Error && e.name === \"WebTransportError\";\n}","tryCatchPattern":"const wt = new WebTransport(url);\ntry {\n  await wt.ready;\n} catch (e) {\n  if (e.name === \"WebTransportError\") {\n    logAndFallback(e.message); // degrade to fetch/ws fallback or surface to user\n    return;\n  }\n  throw e;\n}","preventionTips":["Never leave wt.ready unawaited — always attach a catch handler.","Health-check HTTP/3/QUIC reachability (UDP 443) before enabling WebTransport paths.","Wrap session usage in a connect() helper that owns ready/closed handling."],"tags":["webtransport","http3","quic","connection","async"],"backgroundTag":"connection-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}