EpicGames/lore · error
Failed to parse
Error message
Failed to parse
What it means
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.
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
Example fix
// before
let parsed_response = get_metadata::parse_response(collapse_bytes(&service_output)).expect("Failed to parse");
// after
let parsed_response = get_metadata::parse_response(collapse_bytes(&service_output))
.unwrap_or_else(|e| panic!("Failed to parse get_metadata response: {e:?}")); Defensive patterns
Strategy: validation
Validate before calling
fn response_parses(bytes: &[u8]) -> bool { get_metadata::parse_response(bytes.to_vec()).is_ok() } Type guard
fn looks_like_metadata_response(bytes: &[u8]) -> bool { !bytes.is_empty() && bytes.len() > header_len(bytes) } Try / catch
match get_metadata::parse_response(collapse_bytes(&service_output)) {
Ok(resp) => assert_eq!(resp.match_made, StoreMatch::MatchNone),
Err(e) => panic!("response shape mismatch: {e:?}"),
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- handler should succeed even for a miss
- Failed to create main store
- Failed to create local store
- put should work
- Failed to write data
AI-assisted analysis of EpicGames/lore@074eb0b0d1 (2026-09-13).
Data as JSON: /api/errors/54b929698c37f804.
Report an issue: GitHub.
Appendix: source
Thrown at lore-server/src/quic/replication_store_service/server.rs:1059
.expect("handler failed");
let parsed_response =
get_metadata::parse_response(collapse_bytes(&service_output)).expect("Failed to parse");
assert_eq!(parsed_response.match_made, StoreMatch::MatchFull);
// Regular ImmutableGetMetadata should NOT find it (main store is empty)
let parse_output = service
.parse_request_bytes(
&CommandHeader::new(Command::ImmutableGetMetadata as QuicOpCode, 0, 0),
collapse_bytes_without_header(&request.to_quic_chunks()),
)
.expect("Failed to parse");
let service_output = service
.run_request_handler(AttributeMap::default().into(), parse_output)
.await
.expect("handler should succeed even for a miss");
let parsed_response =
get_metadata::parse_response(collapse_bytes(&service_output)).expect("Failed to parse");
assert_eq!(parsed_response.match_made, StoreMatch::MatchNone);
}
/// Helper to create a second independent store for local-store routing tests
async fn create_two_stores() -> (
Arc<dyn ImmutableStore>,
Arc<dyn ImmutableStore>,
Arc<lore_revision::interface::ExecutionContext>,
) {
let (main_store, _, execution) = test_store_create()
.await
.expect("Failed to create main store");
let (local_store, _, _) = test_store_create()
.await
.expect("Failed to create local store");
(main_store, local_store, execution)
}
View on GitHub (pinned to 074eb0b0d1)