# Space not allowed for username despite Import mode disabled

**URL:** <https://community.auth0.com/t/space-not-allowed-for-username-despite-import-mode-disabled/203388>\
**Category:** Get Help\
**Tags:** custom-database\
**Created:** [September 15, 2026, 6:58pm UTC](https://community.auth0.com/t/space-not-allowed-for-username-despite-import-mode-disabled/203388 "2026-09-15T18:58:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex57](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alex57/32/71783_2.png) [@alex57](https://community.auth0.com/u/alex57)\
**Post date:** [September 15, 2026, 6:58pm UTC](https://community.auth0.com/t/space-not-allowed-for-username-despite-import-mode-disabled/203388/1 "2026-09-15T18:58:47Z")

</div>

We have a custom database for our Auth0 application.

We tried to send a password change ticket to Auth0. It responded with:

`"DB Custom script (get_user): invalid fields. Username can only contain alphanumeric characters and the following characters: '_', '+', '-', '.', '!', '#', '$', ''', '^', '', '~' and '@'."￼`

Per [this Knowledge Base article](https://support.auth0.com/center/s/article/Characters-in-Username-with-custom-database-connections):

> When using custom databases the behaviour is slightly different depending on whether [import mode](https://auth0.com/docs/manage-users/user-migration/configure-automatic-migration-from-your-database) enabled.

If disabled:

> The rules for allowed characters does not apply i.e. you can use any characters for username and it will be accepted.

When I look at our DB config:

- “Import Users to Auth0” Is turned OFF. I presume this means import mode is disabled.

- Under Attributes → Username Configuration: “Use Username as Identifier” is ON.

Should we expect that error to NOT happen, since import mode is off?

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [September 15, 2026, 11:26pm UTC](https://community.auth0.com/t/space-not-allowed-for-username-despite-import-mode-disabled/203388/3 "2026-09-15T23:26:39Z")

</div>

Hi @alex57

Welcome back to the Auth0 Community!

Could you let me know what special characters does the user contain which would trigger the error?

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![alex57](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/alex57/32/71783_2.png) [@alex57](https://community.auth0.com/u/alex57)\
**Post date:** [September 16, 2026, 12:36pm UTC](https://community.auth0.com/t/space-not-allowed-for-username-despite-import-mode-disabled/203388/4 "2026-09-16T12:36:04Z")

</div>

Hi @nik.baleca , thanks for the reply. It’s a space character.

Cheers,

Alex

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [September 17, 2026, 6:08pm UTC](https://community.auth0.com/t/space-not-allowed-for-username-despite-import-mode-disabled/203388/5 "2026-09-17T18:08:14Z")

</div>

Hi again.

You have a custom database configured in Auth0 with "Import Users to Auth0" turned OFF and "Use Username as Identifier" turned ON. When you attempt to send a password change ticket, Auth0 returns a validation error: "invalid fields. Username can only contain alphanumeric characters and the following characters: '\_', '+', '-', '.', '!', '#', '$', ''', '^', '', '~' and '@'."

However, according to the official Auth0 documentation on [allowed characters for usernames](https://auth0.com/docs/authenticate/database-connections/require-username#allowed-characters), Auth0 explicitly states: **"No other characters/symbols are allowed, and Auth0 does not validate or sanitize custom database inputs."**

**[Root Cause]**

Auth0 is performing character validation on your custom database when the Get User script returns the username.

[Solution]

You will need to normalize the username in order to exclude the white space from the username or remove the space from the external database in order for the password change ticket to work.

Kind Regards,  
Nik

---

<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:** [September 19, 2026, 6:08pm UTC](https://community.auth0.com/t/space-not-allowed-for-username-despite-import-mode-disabled/203388/6 "2026-09-19T18:08:23Z")

</div>

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