goharbor/harbor · error

multiple entries found for username

Error message

multiple entries found for username: %s

What it means

Guard in UAA SearchUser: the UAA server returned more than one entry for the username, so the match is ambiguous and no single user can be returned.

Solutions

  1. Resolve duplicate usernames in the UAA/CF identity provider
  2. Use a more specific username query
  3. Deduplicate or rename accounts in UAA, then retry login/onboard
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/auth/uaa/uaa.go:118 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of goharbor/harbor@7b2fd08cc5 (2026-08-16). Data as JSON: /api/errors/29791fc822e18c7d. Report an issue: GitHub.

Appendix: source

Thrown at src/core/auth/uaa/uaa.go:118

		log.Warningf("Failed to update user profile, user: %s, error: %v", user.Username, err2)
	}
	return nil
}

// SearchUser search user on uaa server, transform it to Harbor's user model
func (u *Auth) SearchUser(ctx context.Context, username string) (*models.User, error) {
	if err := u.ensureClient(ctx); err != nil {
		return nil, err
	}
	l, err := u.client.SearchUser(username)
	if err != nil {
		return nil, err
	}
	if len(l) == 0 {
		return nil, nil
	}
	if len(l) > 1 {
		return nil, fmt.Errorf("multiple entries found for username: %s", username)
	}
	e := l[0]
	email := ""
	if len(e.Emails) > 0 {
		email = e.Emails[0].Value
	}
	return &models.User{
		Username: username,
		Email:    email,
	}, nil
}

func (u *Auth) ensureClient(ctx context.Context) error {
	var cfg *uaa.ClientConfig
	UAASettings, err := config.UAASettings(ctx)
	//	log.Debugf("Uaa settings: %+v", UAASettings)
	if err != nil {
		log.Warningf("Failed to get UAA setting from Admin Server, error: %v", err)

View on GitHub (pinned to 7b2fd08cc5)