{"record":{"id":"1a78b0fdc0417a3d","repo":"portainer/portainer","slug":"user-not-found-or-too-many-entries-returned","errorCode":null,"errorMessage":"User not found or too many entries returned","messagePattern":"User not found or too many entries returned","errorType":"exception","errorClass":"errUserNotFound","httpStatus":null,"severity":"error","filePath":"api/ldap/ldap.go","lineNumber":19,"sourceCode":"package ldap\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\tportainer \"github.com/portainer/portainer/api\"\n\t\"github.com/portainer/portainer/api/crypto\"\n\thttperrors \"github.com/portainer/portainer/api/http/errors\"\n\t\"github.com/portainer/portainer/api/logs\"\n\n\tldap \"github.com/go-ldap/ldap/v3\"\n\t\"github.com/pkg/errors\"\n)\n\nvar (\n\t// errUserNotFound defines an error raised when the user is not found via LDAP search\n\t// or that too many entries (> 1) are returned.\n\terrUserNotFound = errors.New(\"User not found or too many entries returned\")\n)\n\n// Service represents a service used to authenticate users against a LDAP/AD.\ntype Service struct{}\n\nfunc createConnection(settings *portainer.LDAPSettings) (*ldap.Conn, error) {\n\tconn, err := createConnectionForURL(settings.URL, settings)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed creating LDAP connection\")\n\t}\n\n\treturn conn, nil\n}\n\nfunc createConnectionForURL(url string, settings *portainer.LDAPSettings) (*ldap.Conn, error) {\n\tif !settings.TLSConfig.TLS && !settings.StartTLS {\n\t\treturn ldap.Dial(\"tcp\", url)\n\t}","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/ldap/ldap.go#L1-L37","documentation":"Error \"User not found or too many entries returned\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/ldap/ldap.go:19 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17e74456ff6e794b9d5439ec3fa06922aa18a3f8","analyzedAt":"2026-08-26T23:09:01.915Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}