{"record":{"id":"7ce5d414fb05cf8a","repo":"EpicGames/lore","slug":"handler-failed","errorCode":null,"errorMessage":"handler failed","messagePattern":"handler failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lore-server/src/quic/replication_store_service/server.rs","lineNumber":1127,"sourceCode":"            Arc::new(UserAgentFilter::default()),\n        );\n\n        // ImmutableLocalQuery should find the data via the local store\n        let parse_output = service\n            .parse_request_bytes(\n                &CommandHeader::new(Command::ImmutableLocalQuery as QuicOpCode, 0, 0),\n                collapse_bytes_without_header(&request.clone().to_quic_chunks()),\n            )\n            .expect(\"Failed to parse\");\n        assert!(matches!(\n            parse_output,\n            ParsedReplicationStoreRequest::Query(_)\n        ));\n\n        let handle_output = service\n            .run_request_handler(AttributeMap::default().into(), parse_output)\n            .await\n            .expect(\"handler failed\");\n        let response = QueryResponse::parse(collapse_bytes(&handle_output))\n            .expect(\"response parse should work\");\n        assert_eq!(response.results[0].match_made, StoreMatch::MatchFull);\n\n        // ImmutableQuery should NOT find it (main store is empty)\n        let parse_output = service\n            .parse_request_bytes(\n                &CommandHeader::new(Command::ImmutableQuery as QuicOpCode, 0, 0),\n                collapse_bytes_without_header(&request.to_quic_chunks()),\n            )\n            .expect(\"Failed to parse\");\n\n        let handle_output = service\n            .run_request_handler(AttributeMap::default().into(), parse_output)\n            .await\n            .expect(\"handler failed\");\n        let response = QueryResponse::parse(collapse_bytes(&handle_output))\n            .expect(\"response parse should work\");","sourceCodeStart":1109,"sourceCodeEnd":1145,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-server/src/quic/replication_store_service/server.rs#L1109-L1145","documentation":"A panic from `.expect(\"handler failed\")` in the test `immutable_local_query_routes_to_local_store`: `run_request_handler` returned an Err when processing an ImmutableLocalQuery after a put into the local store. The library's QuicService routes ImmutableLocalQuery to the local_store (server.rs:182-184); the handler (`request.run()`) failed while executing the query against that store. Since this is a test assertion, the panic means the store or handler surfaced an unexpected error (e.g. store corruption, wrong store wired, or a handler-level internal error).","triggerScenarios":"Calling `service.run_request_handler(...)` with a `ParsedReplicationStoreRequest::Query` when the underlying local store put did not actually land, the handler encounters an internal error while executing the query, or the test's two-store setup wired the query to a store lacking the written fragment.","commonSituations":"Running the replication-store-service test suite after changing store routing (e.g. accidentally pointing ImmutableLocalQuery at immutable_store), breaking the local store's query index, or changing `create_two_stores()` setup so the put silently targets a different store instance.","solutions":["Inspect the Err payload from run_request_handler (print it before expect) to see whether it is AddressNotFound, Internal, or SlowDown.","Verify the put in the preceding LORE_CONTEXT.scope block actually succeeded (its own expect should be checked first).","Confirm in `parse_request_bytes` routing (server.rs:157-193) that ImmutableLocalQuery maps to `self.local_store`, not `immutable_store`.","Re-run with `cargo test immutable_local_query -- --nocapture` after RUST_BACKTRACE=1 to locate the failing store call."],"exampleFix":"// before\nlet handle_output = service\n    .run_request_handler(AttributeMap::default().into(), parse_output)\n    .await\n    .expect(\"handler failed\");\n// after\nlet handle_output = service\n    .run_request_handler(AttributeMap::default().into(), parse_output)\n    .await\n    .unwrap_or_else(|e| panic!(\"handler failed: {e:?}\"));","handlingStrategy":"try-catch","validationCode":"// verify routing before running: ImmutableLocalQuery must target local_store\nassert!(matches!(parse_output, ParsedReplicationStoreRequest::Query(_)));\n// pre-check the data exists locally\nlet hit = local_store.get(address).await;\nassert!(hit.is_ok(), \"local store missing fragment before query\");","typeGuard":"fn is_query(req: &ParsedReplicationStoreRequest) -> bool {\n    matches!(req, ParsedReplicationStoreRequest::Query(_))\n}","tryCatchPattern":"match service.run_request_handler(ctx, parse_output).await {\n    Ok(out) => out,\n    Err(e) => panic!(\"local query handler failed: {e:?}\"), // inspect variant, don't bare-expect\n}","preventionTips":["Always assert the put succeeded before querying in tests.","Keep routing tests (opcode -> store mapping) separate from data tests.","Replace bare .expect with unwrap_or_else(|e| panic!(\"{e:?}\")) so failures are diagnosable."],"tags":["rust","test-panic","quic","store-query"],"backgroundTag":"database-query-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"}