{"record":{"id":"54b929698c37f804","repo":"EpicGames/lore","slug":"failed-to-parse","errorCode":null,"errorMessage":"Failed to parse","messagePattern":"Failed to parse","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lore-server/src/quic/replication_store_service/server.rs","lineNumber":1059,"sourceCode":"            .expect(\"handler failed\");\n        let parsed_response =\n            get_metadata::parse_response(collapse_bytes(&service_output)).expect(\"Failed to parse\");\n        assert_eq!(parsed_response.match_made, StoreMatch::MatchFull);\n\n        // Regular ImmutableGetMetadata should NOT find it (main store is empty)\n        let parse_output = service\n            .parse_request_bytes(\n                &CommandHeader::new(Command::ImmutableGetMetadata as QuicOpCode, 0, 0),\n                collapse_bytes_without_header(&request.to_quic_chunks()),\n            )\n            .expect(\"Failed to parse\");\n\n        let service_output = service\n            .run_request_handler(AttributeMap::default().into(), parse_output)\n            .await\n            .expect(\"handler should succeed even for a miss\");\n        let parsed_response =\n            get_metadata::parse_response(collapse_bytes(&service_output)).expect(\"Failed to parse\");\n        assert_eq!(parsed_response.match_made, StoreMatch::MatchNone);\n    }\n\n    /// Helper to create a second independent store for local-store routing tests\n    async fn create_two_stores() -> (\n        Arc<dyn ImmutableStore>,\n        Arc<dyn ImmutableStore>,\n        Arc<lore_revision::interface::ExecutionContext>,\n    ) {\n        let (main_store, _, execution) = test_store_create()\n            .await\n            .expect(\"Failed to create main store\");\n        let (local_store, _, _) = test_store_create()\n            .await\n            .expect(\"Failed to create local store\");\n        (main_store, local_store, execution)\n    }\n","sourceCodeStart":1041,"sourceCodeEnd":1077,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-server/src/quic/replication_store_service/server.rs#L1041-L1077","documentation":"In the same test, get_metadata::parse_response is applied to the handler's output bytes and .expect('Failed to parse') fires if the response bytes are not a valid get_metadata response. This means the handler produced output that does not match the expected response encoding for the ImmutableLocalGetMetadata operation.","triggerScenarios":"The handler returned an error/empty payload (e.g. after a panic upstream), the response framing changed (header/opcode mismatch), or collapse_bytes mangled chunking so parse_response reads malformed bytes.","commonSituations":"Occurs when protocol chunk encoding is refactored, when the miss path returns a differently shaped response than tests assume, or when the wrong parse function is used for the opcode under test.","solutions":["Confirm parse_response matches the opcode/response type actually produced by run_request_handler","Re-run with the handler error surfaced (fix the sibling 'handler should succeed' expect first, if it fires)","Verify collapse_bytes is applied to service_output exactly as other passing tests do","Update parse_response usage if the response wire format changed"],"exampleFix":"// before\nlet parsed_response = get_metadata::parse_response(collapse_bytes(&service_output)).expect(\"Failed to parse\");\n// after\nlet parsed_response = get_metadata::parse_response(collapse_bytes(&service_output))\n    .unwrap_or_else(|e| panic!(\"Failed to parse get_metadata response: {e:?}\"));","handlingStrategy":"validation","validationCode":"fn response_parses(bytes: &[u8]) -> bool { get_metadata::parse_response(bytes.to_vec()).is_ok() }","typeGuard":"fn looks_like_metadata_response(bytes: &[u8]) -> bool { !bytes.is_empty() && bytes.len() > header_len(bytes) }","tryCatchPattern":"match get_metadata::parse_response(collapse_bytes(&service_output)) {\n    Ok(resp) => assert_eq!(resp.match_made, StoreMatch::MatchNone),\n    Err(e) => panic!(\"response shape mismatch: {e:?}\"),\n}","preventionTips":["Use the parse function matching the exact opcode under test","Apply collapse_bytes identically to passing tests","Update tests whenever response wire framing changes","Surface the parse error instead of bare expect for faster diagnosis"],"tags":["rust","test","parsing","response-format"],"backgroundTag":"unexpected-response-shape","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"}