{"record":{"id":"fe15faa7c40f444f","repo":"juicedata/juicefs","slug":"no-entries-found","errorCode":null,"errorMessage":"no entries found","messagePattern":"no entries found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/win/ldap.go","lineNumber":125,"sourceCode":"\n\tvar msg uintptr\n\tr1, _, _ := procLdapSearchSW.Call(\n\t\thandle,\n\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}","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/win/ldap.go#L107-L143","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\noffset, err := LdapGetTrustPosixOffset(handle, domain)\nif err != nil { return err }\n// after\noffset, err := LdapGetTrustPosixOffset(handle, domain)\nif err != nil {\n    if strings.Contains(err.Error(), \"no entries found\") {\n        return defaultOffset, nil // domain has no explicit offset\n    }\n    return err\n}","handlingStrategy":"fallback","validationCode":"// confirm the object exists before querying (PowerShell):\n// Get-ADObject -Filter \"name -eq 'DOMAIN'\" -SearchBase 'CN=System,...'","typeGuard":null,"tryCatchPattern":"val, err := LdapGetTrustPosixOffset(handle, domain)\nif err != nil {\n    if strings.Contains(err.Error(), \"no entries found\") {\n        val = defaultOffset // expected when no trust/offset exists\n    } else {\n        return err\n    }\n}","preventionTips":["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."],"tags":["windows","ldap","active-directory","empty-result"],"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-14T05:17:10.506Z"}