juicedata/juicefs · warning
no entries found
Error message
no entries found
What it means
LdapGetValue found no entries: ldap_search_sW succeeded but ldap_firstEntry returned 0, so the search matched zero directory entries. The function returns "no entries found" because there is no attribute value to extract. This indicates a query whose filter/base matched nothing, not a transport failure.
Source
Thrown at pkg/win/ldap.go:125
var msg uintptr
r1, _, _ := procLdapSearchSW.Call(
handle,
uintptr(unsafe.Pointer(basePtr)),
uintptr(scope),
uintptr(unsafe.Pointer(filterPtr)),
uintptr(unsafe.Pointer(&attrs[0])),
0,
uintptr(unsafe.Pointer(&msg)),
)
if int32(r1) != LDAP_SUCCESS {
return "", fmt.Errorf("ldap_search_sW failed: %d", r1)
}
defer procLdapMsgFree.Call(msg)
entry, _, _ := procLdapFirstEntry.Call(handle, msg)
if entry == 0 {
return "", fmt.Errorf("no entries found")
}
vals, _, _ := procLdapGetValuesW.Call(handle, entry, uintptr(unsafe.Pointer(attrPtr)))
if vals == 0 {
return "", fmt.Errorf("no attribute values")
}
defer procLdapValueFreeW.Call(vals)
cnt, _, _ := procLdapCountValuesW.Call(vals)
if cnt == 0 {
return "", fmt.Errorf("no attribute values")
}
firstPtr := *(*uintptr)(unsafe.Pointer(vals))
value := windows.UTF16PtrToString((*uint16)(unsafe.Pointer(firstPtr)))
return value, nil
}
func LdapGetDefaultNamingContext(handle uintptr) (string, error) {
return LdapGetValue(handle, "", LDAP_SCOPE_BASE, "(objectClass=*)", "defaultNamingContext")
}View on GitHub (pinned to c9a67b23e8)
Solutions
- Verify the search filter and base DN match real objects (test with AD Users and Computers / ldp.exe or Get-ADObject).
- Confirm the trust relationship exists before querying its posixOffset attribute.
- Treat this as an expected case when the domain has no TrustPosixOffset and fall back to a default ID mapping.
- Check the defaultNamingContext returned by LdapGetDefaultNamingContext is correct.
Example fix
// before
offset, err := LdapGetTrustPosixOffset(handle, domain)
if err != nil { return err }
// after
offset, err := LdapGetTrustPosixOffset(handle, domain)
if err != nil {
if strings.Contains(err.Error(), "no entries found") {
return defaultOffset, nil // domain has no explicit offset
}
return err
} Defensive patterns
Strategy: fallback
Validate before calling
// confirm the object exists before querying (PowerShell): // Get-ADObject -Filter "name -eq 'DOMAIN'" -SearchBase 'CN=System,...'
Try / catch
val, err := LdapGetTrustPosixOffset(handle, domain)
if err != nil {
if strings.Contains(err.Error(), "no entries found") {
val = defaultOffset // expected when no trust/offset exists
} else {
return err
}
} Prevention
- Validate domain names/filters against real AD objects first.
- Treat empty LDAP results as a normal case for optional attributes.
- Test queries with ldp.exe or Get-ADObject before coding them.
When it happens
Trigger: Searching for a trusted domain object or naming context where the filter matches nothing — wrong domain name, trust doesn't exist, or the base DN points at an empty subtree.
Common situations: Querying TrustPosixOffset for a domain with no POSIX offset attribute set; querying a child domain that has no trust configured; misspelled domain NetBIOS/FQDN in the filter.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- ldap_initW failed
- ldap_bind_sW failed: %d
- ldap_search_sW failed: %d
- no attribute values
- LdapConnect failed: %w
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/fe15faa7c40f444f.
Report an issue: GitHub.