# Custom Database Connection Errors causing Blocked Users

**URL:** <https://community.auth0.com/t/custom-database-connection-errors-causing-blocked-users/185838>\
**Category:** Get Help\
**Tags:** identifier-first, login-experience\
**Created:** [April 23, 2025, 11:12am UTC](https://community.auth0.com/t/custom-database-connection-errors-causing-blocked-users/185838 "2025-04-23T11:12:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![simon.pain](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/simon.pain/32/70577_2.png) [@simon.pain](https://community.auth0.com/u/simon.pain)\
**Post date:** [April 23, 2025, 11:12am UTC](https://community.auth0.com/t/custom-database-connection-errors-causing-blocked-users/185838/1 "2025-04-23T11:12:48Z")

</div>

Good day.

In our testing we’ve found an interesting case where a user can be blocked for having too many incorrect logins, even if it’s not their fault, it’s just that there was a connection error between Auth0 and our custom Auth Provider.

I can see in [the documentation](https://auth0.com/docs/authenticate/database-connections/custom-db/error-handling) that

```auto
return callback(new WrongUsernameOrPasswordError(userNameOrEmail, "My custom error message"));

```

causes a `fp` log message to be created, which makes sense. Also

```auto
return callback(new WrongUsernameOrPasswordError(null, "My custom error message"));

```

causes an `fu` log message which also makes sense.

What doesn’t make so much sense to me is that

```auto
return callback(new UnauthorizedError("An error occurred"));

```

and

```auto
return callback(new Error("An error occurred"));

```

both also cause an `fu` to be logged and contribute to the count of logins that lead to the blocking of users.

```auto
{
  "date": "2025-04-23T11:10:32.406Z",
  "type": "limit_wc",
  "description": "User (simon.pain@example.com) attempted 5 consecutive logins unsuccessfully. Brute force protection is enabled for this connection, further attempts are blocked from this IP address for this user.",
  "connection": "Username-Password-Authentication"
}

```

Is there any way in the Custom DB Script to log an error that’s “our problem” rather than the user’s problem so that it doesn’t count towards applying a login block to the user?

Many Thanks

Simon

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [April 30, 2025, 9:06pm UTC](https://community.auth0.com/t/custom-database-connection-errors-causing-blocked-users/185838/3 "2025-04-30T21:06:52Z")

</div>

Hi @simon.pain

Welcome to the Auth0 Community!

I’ll report this behaviour to our Engineering team. I will update you as soon as I have more details from them!

Thank you for being a part of our community! 🤝  
Dawid

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 14, 2025, 9:07pm UTC](https://community.auth0.com/t/custom-database-connection-errors-causing-blocked-users/185838/4 "2025-05-14T21:07:07Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
