Login Flow Action Error with not created email

Hello, i created a action so users can’t login/register with the same account in database or social, but when i try to login the system says that the account already exits, but i don’t.

    const params = {
        search_engine: 'v3',
        q: `email:"${event.user.email}"`
    };

    try {
        const users = await management.getUsers(params);
        if (users.length > 0) {
            management.users.delete({ id: event.user.user_id });
            api.access.deny('It looks like there is already an account associated with this email. Login or reset your password if you forgot it.');
        }
    } catch (e) {
        console.log(e)
        api.access.deny('Something went wrong. Please try again later.');
    }

The idea was to like when a user creates an account with the connection database, and if he tries to login with social connection and the email is the same it deletes the account and return error.