diff --git a/src/jamidht/server_account_manager.cpp b/src/jamidht/server_account_manager.cpp
index f6a54c840077fa5164e94ff6f0a388f04efb3d19..cd3d00926b8c18e8161dce6810824f7cf0430abc 100644
--- a/src/jamidht/server_account_manager.cpp
+++ b/src/jamidht/server_account_manager.cpp
@@ -72,7 +72,7 @@ ServerAccountManager::initAuthentication(
     ctx->onSuccess = std::move(onSuccess);
     ctx->onFailure = std::move(onFailure);
     if (not ctx->credentials or ctx->credentials->username.empty()) {
-        onFailure(AuthError::INVALID_ARGUMENTS, "invalid credentials");
+        ctx->onFailure(AuthError::INVALID_ARGUMENTS, "invalid credentials");
         return;
     }