{"record":{"id":"f922328b63c48d93","repo":"juicedata/juicefs","slug":"no-attribute-values","errorCode":null,"errorMessage":"no attribute values","messagePattern":"no attribute values","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/win/ldap.go","lineNumber":129,"sourceCode":"\t\tuintptr(unsafe.Pointer(basePtr)),\n\t\tuintptr(scope),\n\t\tuintptr(unsafe.Pointer(filterPtr)),\n\t\tuintptr(unsafe.Pointer(&attrs[0])),\n\t\t0,\n\t\tuintptr(unsafe.Pointer(&msg)),\n\t)\n\tif int32(r1) != LDAP_SUCCESS {\n\t\treturn \"\", fmt.Errorf(\"ldap_search_sW failed: %d\", r1)\n\t}\n\tdefer procLdapMsgFree.Call(msg)\n\n\tentry, _, _ := procLdapFirstEntry.Call(handle, msg)\n\tif entry == 0 {\n\t\treturn \"\", fmt.Errorf(\"no entries found\")\n\t}\n\tvals, _, _ := procLdapGetValuesW.Call(handle, entry, uintptr(unsafe.Pointer(attrPtr)))\n\tif vals == 0 {\n\t\treturn \"\", fmt.Errorf(\"no attribute values\")\n\t}\n\tdefer procLdapValueFreeW.Call(vals)\n\tcnt, _, _ := procLdapCountValuesW.Call(vals)\n\tif cnt == 0 {\n\t\treturn \"\", fmt.Errorf(\"no attribute values\")\n\t}\n\tfirstPtr := *(*uintptr)(unsafe.Pointer(vals))\n\tvalue := windows.UTF16PtrToString((*uint16)(unsafe.Pointer(firstPtr)))\n\treturn value, nil\n}\n\nfunc LdapGetDefaultNamingContext(handle uintptr) (string, error) {\n\treturn LdapGetValue(handle, \"\", LDAP_SCOPE_BASE, \"(objectClass=*)\", \"defaultNamingContext\")\n}\n\nfunc LdapGetTrustPosixOffset(\n\thandle uintptr,\n\tcontext string,","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/win/ldap.go#L111-L147","documentation":"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.","triggerScenarios":"Requesting an attribute (e.g. trustPosixOffset or defaultNamingContext) that does not exist on the returned entry, so ldap_get_valuesW yields NULL.","commonSituations":"Domain controllers without the POSIX offset attribute populated (ID mapping never configured); requesting a mistyped attribute name; schema differences between AD versions.","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."],"exampleFix":"// before\nvals, _, _ := procLdapGetValuesW.Call(handle, entry, uintptr(unsafe.Pointer(attrPtr)))\nif vals == 0 {\n    return \"\", fmt.Errorf(\"no attribute values\")\n}\n// after (caller)\nval, err := LdapGetValue(handle, entry, \"trustPosixOffset\")\nif err != nil && strings.Contains(err.Error(), \"no attribute values\") {\n    val = strconv.Itoa(fallbackOffset)\n}","handlingStrategy":"fallback","validationCode":"// check attribute presence beforehand:\n// Get-ADObject -Properties trustPosixOffset <dn>","typeGuard":null,"tryCatchPattern":"val, err := LdapGetValue(handle, dn, filter, attr)\nif err != nil && strings.Contains(err.Error(), \"no attribute values\") {\n    val = fallbackValueFor(attr)\n}","preventionTips":["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."],"tags":["windows","ldap","active-directory","missing-attribute"],"backgroundTag":"empty-result-set","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}