When you automatically import your existing userbase in Matomo (Piwik) using the UsersManager API, you might want to disable the check of minimum length and valid characters for the User’s login and password.
In particular, Matomo requires a password at least 6 characters long, and a login string that must contain only valid characters (ie. letters, @, etc.).
You can disable these checks by adding in the file config/config.ini.php the following:

disable_checks_usernames_attributes = 1