diff --git a/src/Olm.cpp b/src/Olm.cpp
index 338a392502d279f6b4b8af3bbb4728fb1250c3c7..81121443d5e419c57da459452818caea6bc0c420 100644
--- a/src/Olm.cpp
+++ b/src/Olm.cpp
@@ -1406,9 +1406,12 @@ request_cross_signing_keys()
                   body,
                   [request_id = secretRequest.request_id, secretName](mtx::http::RequestErr err) {
                           if (err) {
-                                  request_id_to_secret_name.erase(request_id);
                                   nhlog::net()->error("Failed to send request for secrect '{}'",
                                                       secretName);
+                                  // Cancel request on UI thread
+                                  QTimer::singleShot(1, cache::client(), [request_id]() {
+                                          request_id_to_secret_name.erase(request_id);
+                                  });
                                   return;
                           }
                   });