Forum OpenACS Q&A: on attempt to register, "'We already have a user with this username.' on element 'username'"

Hi, running 5.7 with pg-8.3, the kernel parameter is set to use email to log in, this happens every time I try to register, looking at APM listing, two packages found to be involved (aca-authentication and acs-subsite) have version 5.7.0...

Where do I look to find the problem? I'm looking for where the code generates this message, so far no go.

[30/Jul/2013:23:54:28][26162.18446744072149501696][-default:130-] Error: Error in include template "/web/mu-dev/packages/acs-subsite/lib/user-new": Validation error in hidden form element: 'We already have a user with this username.' on element 'username'.
Validation error in hidden form element: 'We already have a user with this username.' on element 'username'.
while executing
"error "Validation error in hidden form element: '[set $id:error($element(id))]' on element '$element(id)'.""
(procedure "template::form::render" line 85)
invoked from within
"template::form::render register { }"
("eval" body line 1)
invoked from within
"eval template::form::$command $args"
(procedure "template::form" line 2)
invoked from within
"template::form render register { } "
("uplevel" body line 15)
invoked from within
"uplevel {
set __adp_output ""
set form:id "register"

upvar 0 "register:properties" form_properties

set form_properties(headers) ""


..."
(procedure "template::code::adp::/web/mu-dev/packages/acs-subsite/lib/us..." line 2)
invoked from within
"template::code::${template_extension}::$__adp_stub"
invoked from within
"template::adp_parse [template::util::url_to_file "[ad_quotehtml [lang::util::localize ${user_new_template}]]" "$__adp_stub"] [list email "[ad_quotehtm..."

found the message in the subsite catalog:

./packages/acs-subsite/catalog/acs-subsite.en_US.ISO-8859-1.xml: <msg key="Have_user_name">We already have a user with this username.</msg>

and, found where the message key is used (only one place) at the end of auth::validate_account_info, in file packages/acs-authentication/tcl/authentication-procs.tcl, with the relevent code being:

ad_proc -private auth::validate_account_info {
    {-update:boolean}
    {-authority_id:required}
    {-username:required}
    {-user_array:required}
    {-message_array:required}
} { ... } {

    :
    :

    # (here is the end of the proc)

    # They're trying to set the username
    if { [exists_and_not_null user(username)] } {
        # Check that username is unique
        set username_user_id [acs_user::get_by_username -authority_id $authority_id -username $user(username)]

        if { $username_user_id ne "" && (!$update_p || $username_user_id != $user(user_id)) } {
            # We already have a user with this username, and either we're not updating, or it's not the same user_id as the one we're updating
            
            set username_member_state [acs_user::get_element -user_id $username_user_id -element member_state] 
            switch $username_member_state {
                banned {
                    # A user with this username does exist, but he's banned, so we can 'steal' his username
                    # by setting it to something dummy
                    acs_user::update \
                        -user_id $username_user_id \
                        -username "dummy-username-$username_user_id"
                }
                default { 
                    set element_messages(username) [_ acs-subsite.Have_user_name]
                }
            }
        }
    }
}