juicedata/juicefs · warning
no attribute values
Error message
no attribute values
What it means
An entry was found but ldap_get_valuesW returned a NULL pointer for the requested attribute, so LdapGetValue returns "no attribute values": the attribute is either not present on the entry or has no values. This is the pointer==0 variant of the empty-attribute case.
Source
Thrown at pkg/win/ldap.go:129
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")
}
func LdapGetTrustPosixOffset(
handle uintptr,
context string,View on GitHub (pinned to c9a67b23e8)
Solutions
- Check the attribute name string passed to LdapGetValue for typos.
- Verify with PowerShell (Get-ADObject -Properties trustPosixOffset) whether the attribute exists on the object.
- Fall back to a default value when the attribute is legitimately absent.
- Populate the attribute via ID mapping management tools if it should exist.
Example fix
// before
vals, _, _ := procLdapGetValuesW.Call(handle, entry, uintptr(unsafe.Pointer(attrPtr)))
if vals == 0 {
return "", fmt.Errorf("no attribute values")
}
// after (caller)
val, err := LdapGetValue(handle, entry, "trustPosixOffset")
if err != nil && strings.Contains(err.Error(), "no attribute values") {
val = strconv.Itoa(fallbackOffset)
} Defensive patterns
Strategy: fallback
Validate before calling
// check attribute presence beforehand: // Get-ADObject -Properties trustPosixOffset <dn>
Try / catch
val, err := LdapGetValue(handle, dn, filter, attr)
if err != nil && strings.Contains(err.Error(), "no attribute values") {
val = fallbackValueFor(attr)
} Prevention
- Spell attribute names exactly as in the AD schema.
- Provide defaults for optional attributes like trustPosixOffset.
- Document which AD features must be configured for the attribute to exist.
When it happens
Trigger: Requesting an attribute (e.g. trustPosixOffset or defaultNamingContext) that does not exist on the returned entry, so ldap_get_valuesW yields NULL.
Common situations: Domain controllers without the POSIX offset attribute populated (ID mapping never configured); requesting a mistyped attribute name; schema differences between AD versions.
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 entries found
- LdapConnect failed: %w
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/f922328b63c48d93.
Report an issue: GitHub.