{"record":{"id":"458f61bdfa75f04d","repo":"EpicGames/lore","slug":"failed-quinn-server-start","errorCode":null,"errorMessage":"Failed Quinn server start","messagePattern":"Failed Quinn server start","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lore-server/src/quic/stream_handler.rs","lineNumber":884,"sourceCode":"    async fn serve_and_connect(\n        factory: Box<dyn StreamHandlerFactory>,\n        protocol: &'static str,\n    ) -> Harness {\n        let socket = UdpSocket::bind(\"127.0.0.1:0\").unwrap();\n        let server_addr = socket.local_addr().expect(\"Failed socket setup\");\n        drop(socket);\n\n        let (cert_path, key_path, _) = server_certs().expect(\"Bad cert paths\");\n        let server = QuinnServer::start(\n            QuinnConfigBuilder::new()\n                .address(server_addr)\n                .cert_file(cert_path)\n                .pkey_file(key_path)\n                .stream_handler_factory(factory)\n                .build()\n                .unwrap(),\n        )\n        .expect(\"Failed Quinn server start\");\n\n        let mut crypto_config = rustls::ClientConfig::builder()\n            .dangerous()\n            .with_custom_certificate_verifier(insecure_client_auth::SkipServerVerification::new())\n            .with_no_client_auth();\n        crypto_config.alpn_protocols = vec![protocol.as_bytes().into()];\n\n        let client_config = ClientConfig::new(Arc::new(\n            QuicClientConfig::try_from(crypto_config).expect(\"Failed client config\"),\n        ));\n\n        let client_addr: SocketAddr = \"0.0.0.0:0\".parse().unwrap();\n        let mut endpoint = Endpoint::client(client_addr).expect(\"Failed to create client endpoint\");\n        endpoint.set_default_client_config(client_config);\n\n        let connection = endpoint\n            .connect(server_addr, \"localhost\")\n            .unwrap()","sourceCodeStart":866,"sourceCodeEnd":902,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-server/src/quic/stream_handler.rs#L866-L902","documentation":"This expect wraps QuinnServer::start(...), which builds and launches the QUIC server with the given address, cert/key files, and stream-handler factory. A failure means the server could not initialize — typically the UDP bind failed, the TLS files were rejected, or config construction was invalid.","triggerScenarios":"Address already bound by another socket, cert_file/pkey_file point to unreadable or mismatched files, or QuinnConfigBuilder output is inconsistent (though build() is unwrapped earlier).","commonSituations":"Parallel tests racing to bind the same fixed port; leftover server from a previous test run holding the port; expired/mismatched test certificates; container without UDP permissions.","solutions":["Check the underlying QuinnServer::start error (bind refused vs TLS load failed)","Use ephemeral ports (127.0.0.1:0 resolved via local_addr, as this harness does) and avoid fixed ports in parallel tests","Kill stale test servers holding the port (lsof/SS on the port)","Validate cert/key pair match and readability before starting the server"],"exampleFix":"// before\nQuinnServer::start(config_builder.build().unwrap(), ...).expect(\"Failed Quinn server start\");\n// after\nQuinnServer::start(config, ...).unwrap_or_else(|e| panic!(\"Failed Quinn server start: {e:?} (addr={server_addr})\"));","handlingStrategy":"validation","validationCode":"// pre-checks before QuinnServer::start\nassert!(std::path::Path::new(&cert_path).exists());\nassert!(std::path::Path::new(&key_path).exists());\nassert!(std::net::UdpSocket::bind(server_addr).is_err(), \"port unexpectedly free/held race\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use ephemeral ports resolved via local_addr in tests","Kill stale servers from previous runs before retrying","Validate cert/key pair match before server startup","Read the QuinnServer::start error to separate bind vs TLS failures"],"tags":["quic","server","tls","rust","test-harness"],"backgroundTag":"module-init-failed","analyzedSha":"074eb0b0d1194c997d7cf28b55519e3e197b3e23","analyzedAt":"2026-09-13T09:00:57.509Z","contentChangedAt":"2026-09-13T09:00:57.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}