{"record":{"id":"348b336cd2b63c8e","repo":"EpicGames/lore","slug":"bad-cert-paths","errorCode":null,"errorMessage":"Bad cert paths","messagePattern":"Bad cert paths","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lore-server/src/quic/stream_handler.rs","lineNumber":874,"sourceCode":"        recv.read_exact(&mut buffer)\n            .await\n            .expect(\"Failed to read response\");\n        CommandHeader::from_bytes(&buffer)\n    }\n\n    /// Serve `factory` for `protocol` on a loopback endpoint and open a client stream to it.\n    ///\n    /// The client skips certificate verification and presents none of its own; the mTLS tests\n    /// build their endpoints by hand because varying exactly that is what they test.\n    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(","sourceCodeStart":856,"sourceCodeEnd":892,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-server/src/quic/stream_handler.rs#L856-L892","documentation":"This expect wraps server_certs(), the helper that locates/creates the test TLS certificate and private key files used by QuinnServer. It panics when the cert/key files cannot be found, generated, or parsed.","triggerScenarios":"server_certs() cannot locate the embedded/generated rcgen cert paths, lacks permission to write the cert directory, or the key material is missing/corrupt.","commonSituations":"Running tests in a read-only or scrubbed CI workspace where generated certs were deleted; rcgen version change altering the returned paths; wrong working directory assumptions in the cert helper.","solutions":["Run server_certs() directly in a small test to see its underlying Err","Ensure the test environment allows writing/reading the cert directory the helper uses","Regenerate test certificates (cargo test usually does this via the helper) and confirm files exist","Check rcgen dependency versions for API/path changes in cert generation"],"exampleFix":"// before\nlet (cert_path, key_path, _) = server_certs().expect(\"Bad cert paths\");\n// after\nlet (cert_path, key_path, _) = server_certs()\n    .unwrap_or_else(|e| panic!(\"Bad cert paths: {e:?}; cwd={:?}\", std::env::current_dir()));","handlingStrategy":"validation","validationCode":"let cert_path = std::path::Path::new(&cert_path);\nlet key_path = std::path::Path::new(&key_path);\nassert!(cert_path.exists(), \"cert missing: {:?}\", cert_path);\nassert!(key_path.exists(), \"key missing: {:?}\", key_path);","typeGuard":"fn certs_present(cert: &std::path::Path, key: &std::path::Path) -> bool {\n    cert.is_file() && key.is_file()\n}","tryCatchPattern":null,"preventionTips":["Call the cert helper once and reuse the paths rather than regenerating per test","Ensure the test workspace is writable and not scrubbed between CI steps","Pin rcgen versions to avoid path/API drift in cert generation"],"tags":["tls","certificates","test-harness","rust"],"backgroundTag":"file-not-found","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"}