goharbor/harbor · error

can not bind search dn, error: %v

Error message

can not bind search dn, error: %v

What it means

Error "can not bind search dn, error: %v" thrown in goharbor/harbor.

Source

Thrown at src/pkg/ldap/ldap.go:253

	attributes := []string{"uid", "cn", "mail", "email"}
	lowerUID := strings.ToLower(s.basicCfg.UID)

	if lowerUID != "uid" && lowerUID != "cn" && lowerUID != "mail" && lowerUID != "email" {
		attributes = append(attributes, s.basicCfg.UID)
	}

	// Add the Group membership attribute
	groupAttr := strings.TrimSpace(s.groupCfg.MembershipAttribute)
	log.Debugf("Membership attribute: %s\n", groupAttr)
	attributes = append(attributes, groupAttr)

	return s.SearchLdapAttribute(s.basicCfg.BaseDn, filter, attributes)
}

// SearchLdapAttribute - to search ldap with the provide filter, with specified attributes
func (s *Session) SearchLdapAttribute(baseDN, filter string, attributes []string) (*goldap.SearchResult, error) {
	if err := s.Bind(s.basicCfg.SearchDn, s.basicCfg.SearchPassword); err != nil {
		return nil, fmt.Errorf("can not bind search dn, error: %v", err)
	}
	filter = normalizeFilter(filter)
	if len(filter) == 0 {
		return nil, ErrInvalidFilter
	}
	if _, err := goldap.CompileFilter(filter); err != nil {
		log.Errorf("Wrong filter format, filter:%v", filter)
		return nil, ErrInvalidFilter
	}
	log.Debugf("Search ldap with filter:%v", filter)
	searchRequest := goldap.NewSearchRequest(
		baseDN,
		s.basicCfg.Scope,
		goldap.NeverDerefAliases,
		0,     // Unlimited results
		0,     // Search Timeout
		false, // Types only
		filter,

View on GitHub (pinned to 7b2fd08cc5)

When it happens

Trigger: Thrown at src/pkg/ldap/ldap.go:253 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/1fc5d213647ad947. Report an issue: GitHub.