EpicGames/lore · error

handler failed

Error message

handler failed

What it means

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).

Solutions

  1. Inspect the Err payload from run_request_handler (print it before expect) to see whether it is AddressNotFound, Internal, or SlowDown.
  2. Verify the put in the preceding LORE_CONTEXT.scope block actually succeeded (its own expect should be checked first).
  3. Confirm in `parse_request_bytes` routing (server.rs:157-193) that ImmutableLocalQuery maps to `self.local_store`, not `immutable_store`.
  4. Re-run with `cargo test immutable_local_query -- --nocapture` after RUST_BACKTRACE=1 to locate the failing store call.

Example fix

// before
let handle_output = service
    .run_request_handler(AttributeMap::default().into(), parse_output)
    .await
    .expect("handler failed");
// after
let handle_output = service
    .run_request_handler(AttributeMap::default().into(), parse_output)
    .await
    .unwrap_or_else(|e| panic!("handler failed: {e:?}"));
Defensive patterns

Strategy: try-catch

Validate before calling

// verify routing before running: ImmutableLocalQuery must target local_store
assert!(matches!(parse_output, ParsedReplicationStoreRequest::Query(_)));
// pre-check the data exists locally
let hit = local_store.get(address).await;
assert!(hit.is_ok(), "local store missing fragment before query");

Type guard

fn is_query(req: &ParsedReplicationStoreRequest) -> bool {
    matches!(req, ParsedReplicationStoreRequest::Query(_))
}

Try / catch

match service.run_request_handler(ctx, parse_output).await {
    Ok(out) => out,
    Err(e) => panic!("local query handler failed: {e:?}"), // inspect variant, don't bare-expect
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of EpicGames/lore@074eb0b0d1 (2026-09-13). Data as JSON: /api/errors/7ce5d414fb05cf8a. Report an issue: GitHub.

Appendix: source

Thrown at lore-server/src/quic/replication_store_service/server.rs:1127

            Arc::new(UserAgentFilter::default()),
        );

        // ImmutableLocalQuery should find the data via the local store
        let parse_output = service
            .parse_request_bytes(
                &CommandHeader::new(Command::ImmutableLocalQuery as QuicOpCode, 0, 0),
                collapse_bytes_without_header(&request.clone().to_quic_chunks()),
            )
            .expect("Failed to parse");
        assert!(matches!(
            parse_output,
            ParsedReplicationStoreRequest::Query(_)
        ));

        let handle_output = service
            .run_request_handler(AttributeMap::default().into(), parse_output)
            .await
            .expect("handler failed");
        let response = QueryResponse::parse(collapse_bytes(&handle_output))
            .expect("response parse should work");
        assert_eq!(response.results[0].match_made, StoreMatch::MatchFull);

        // ImmutableQuery should NOT find it (main store is empty)
        let parse_output = service
            .parse_request_bytes(
                &CommandHeader::new(Command::ImmutableQuery as QuicOpCode, 0, 0),
                collapse_bytes_without_header(&request.to_quic_chunks()),
            )
            .expect("Failed to parse");

        let handle_output = service
            .run_request_handler(AttributeMap::default().into(), parse_output)
            .await
            .expect("handler failed");
        let response = QueryResponse::parse(collapse_bytes(&handle_output))
            .expect("response parse should work");

View on GitHub (pinned to 074eb0b0d1)