{"record":{"id":"7c231190cd6aa641","repo":"puppetlabs/puppet","slug":"could-not-get-dn-from-ldap-entry","errorCode":null,"errorMessage":"Could not get dn from ldap entry","messagePattern":"Could not get dn from ldap entry","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/util/ldap/manager.rb","lineNumber":94,"sourceCode":"    end\n    nil\n  end\n\n  # Convert the name to a dn, then pass the args along to\n  # our connection.\n  def delete(name)\n    connect { |connection| connection.delete dn(name) }\n  end\n\n  # Calculate the dn for a given resource.\n  def dn(name)\n    [\"#{rdn}=#{name}\", base].join(\",\")\n  end\n\n  # Convert an ldap-style entry hash to a provider-style hash.\n  def entry2provider(entry)\n    # TRANSLATOR 'dn' refers to a 'distinguished name' in LDAP (Lightweight Directory Access Protocol) and they should not be translated\n    raise ArgumentError, _(\"Could not get dn from ldap entry\") unless entry[\"dn\"]\n\n    # DN is always a single-entry array.  Strip off the bits before the\n    # first comma, then the bits after the remaining equal sign.  This is the\n    # name.\n    name = entry[\"dn\"].dup.pop.split(\",\").shift.split(\"=\").pop\n\n    result = { :name => name }\n\n    @ldap2puppet.each do |ldap, puppet|\n      result[puppet] = entry[ldap.to_s] || :absent\n    end\n\n    result\n  end\n\n  # Create our normal search filter.\n  def filter\n    (objectclasses.length == 1 ? \"objectclass=#{objectclasses[0]}\" : \"(&(objectclass=\" + objectclasses.join(\")(objectclass=\") + \"))\")","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/ldap/manager.rb#L76-L112","documentation":"ArgumentError raised by Puppet::Util::Ldap::Manager#entry2provider when converting a raw LDAP entry hash that lacks the 'dn' (distinguished name) key. It indicates the entry returned from the LDAP search is malformed or not a real entry, so it cannot be translated into a provider-style resource hash.","triggerScenarios":"Thrown at lib/puppet/util/ldap/manager.rb:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the LDAP entry returned by the search to see why it has no dn","Verify the LDAP base and search filter are not returning container/partial entries","Check the ldapsearch result with the same filter used by the provider"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","contentChangedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}