{"record":{"id":"bc0b2a61fa9b9fce","repo":"EpicGames/lore","slug":"put-should-work","errorCode":null,"errorMessage":"put should work","messagePattern":"put should work","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lore-server/src/quic/replication_store_service/server.rs","lineNumber":1093,"sourceCode":"        (main_store, local_store, execution)\n    }\n\n    #[tokio::test]\n    async fn immutable_local_query_routes_to_local_store() {\n        let (main_store, local_store, execution) = create_two_stores().await;\n\n        let repository = random::<Context>();\n        let (fragment, address, payload) = fragment::generate_random();\n\n        // put data only in the local store\n        {\n            let local_store = local_store.clone();\n            LORE_CONTEXT\n                .scope(execution.clone(), async move {\n                    local_store\n                        .put(repository.into(), address, fragment, Some(payload), false)\n                        .await\n                        .expect(\"put should work\");\n                })\n                .await;\n        }\n\n        let request = Query {\n            header: ReplicationHeader {\n                correlation_id: Uuid::new_v4(),\n                repository,\n            },\n            addresses: vec![address],\n        };\n\n        let service = ReplicationStoreService::new(\n            main_store.clone(),\n            local_store.clone(),\n            Arc::new(UserAgentFilter::default()),\n        );\n","sourceCodeStart":1075,"sourceCodeEnd":1111,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-server/src/quic/replication_store_service/server.rs#L1075-L1111","documentation":"In immutable_local_query_routes_to_local_store, the test puts a fragment into the local store via local_store.put(...) and panics if the put fails. The put is expected to always succeed because it is seeding data for the subsequent query-routing assertion; failure means the local store rejected the write.","triggerScenarios":"put returns Err due to store capacity/config issues, wrong repository/address/fragment arguments after API changes, the ExecutionContext scope not being active (LORE_CONTEXT.scope), or a store that was not properly initialized.","commonSituations":"Refactors changing the put signature (the trailing bool flag) leaving arguments misaligned, missing context causing internal put errors, or the local store being dropped/closed before the puts complete.","solutions":["Check the put error message to identify which precondition failed (context, store state, or argument validation)","Confirm the put call still matches the current signature (repository, address, fragment, payload Option, bool)","Ensure the LORE_CONTEXT.scope(execution) wrapper is present and the execution context is the one from create_two_stores","Verify the fragment/payload sizes are within store limits"],"exampleFix":"// before\nlocal_store.put(repository.into(), address, fragment, Some(payload), false).await.expect(\"put should work\");\n// after\nlocal_store.put(repository.into(), address, fragment, Some(payload), false).await\n    .unwrap_or_else(|e| panic!(\"local store put failed: {e:?}\"));","handlingStrategy":"try-catch","validationCode":"// ensure context scope and store readiness before puts\nassert!(LORE_CONTEXT.try_with(|_| true).is_ok(), \"LORE_CONTEXT not active\");","typeGuard":null,"tryCatchPattern":"match local_store.put(repository.into(), address, fragment, Some(payload), false).await {\n    Ok(_) => {},\n    Err(e) => panic!(\"seeding put failed: {e:?} — check signature, context scope, store state\"),\n}","preventionTips":["Keep put call sites updated when the signature/flag arguments change","Always wrap seeding writes in LORE_CONTEXT.scope with the correct ExecutionContext","Verify store initialization succeeded before writing","Validate fragment/payload sizes against store limits in test fixtures"],"tags":["rust","test","store","write","async"],"backgroundTag":"database-write-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"}