{"record":{"id":"19f90fa736ee930e","repo":"puppetlabs/puppet","slug":"value-must-be-in-domain-object-class-style-syn","errorCode":null,"errorMessage":"Value must be in DOMAIN\\\\%{object_class} style syntax","messagePattern":"Value must be in DOMAIN\\\\\\\\%(.+?) style syntax","errorType":"validation","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/util/windows/adsi.rb","lineNumber":161,"sourceCode":"      def localized_domains\n        @localized_domains ||= [\n          # localized version of BUILTIN\n          # for instance VORDEFINIERT on German Windows\n          Puppet::Util::Windows::SID.sid_to_name('S-1-5-32').upcase,\n          # localized version of NT AUTHORITY (can't use S-1-5)\n          # for instance AUTORITE NT on French Windows\n          Puppet::Util::Windows::SID.name_to_principal('SYSTEM').domain.upcase\n        ]\n      end\n\n      def uri(name, host = '.')\n        host = '.' if (localized_domains << Socket.gethostname.upcase).include?(host.upcase)\n        Puppet::Util::Windows::ADSI.uri(name, @object_class, host)\n      end\n\n      def parse_name(name)\n        if name =~ %r{/}\n          raise Puppet::Error, _(\"Value must be in DOMAIN\\\\%{object_class} style syntax\") % { object_class: @object_class }\n        end\n\n        matches = name.scan(/((.*)\\\\)?(.*)/)\n        domain = matches[0][1] || '.'\n        account = matches[0][2]\n\n        [account, domain]\n      end\n\n      # returns Puppet::Util::Windows::SID::Principal[]\n      # may contain objects that represent unresolvable SIDs\n      def get_sids(adsi_child_collection)\n        sids = []\n        adsi_child_collection.each do |m|\n          sids << Puppet::Util::Windows::SID.ads_to_principal(m)\n        rescue Puppet::Util::Windows::Error => e\n          case e.code\n          when Puppet::Util::Windows::SID::ERROR_TRUSTED_RELATIONSHIP_FAILURE, Puppet::Util::Windows::SID::ERROR_TRUSTED_DOMAIN_FAILURE","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/windows/adsi.rb#L143-L179","documentation":"Raised by ADSIObject.parse_name when the account name contains a forward slash. The WinNT provider used by Puppet's local user/group code expects DOMAIN\\\\account syntax (backslash) or a bare name; a '/' indicates URI-style ('WinNT://...') or LDAP-style input that cannot be interpreted, so it is rejected before any directory lookup.","triggerScenarios":"Passing 'DOMAIN/bob' or 'computer/user' to Puppet::Util::Windows::ADSI::User or Group helpers (exists?, create, []) which route through parse_name; declaring a puppet user/group resource whose name contains '/'.","commonSituations":"Porting Unix manifests where '/' in names is harmless; generating account names from file paths or URLs; pasting LDAP DNs or WinNT URIs instead of flat account names.","solutions":["Use backslash syntax 'DOMAIN\\\\bob', or just the bare account name for local accounts.","Strip path-like prefixes and URI wrappers when generating names programmatically."],"exampleFix":"# before\nPuppet::Util::Windows::ADSI::User.exists?('DOMAIN/bob')\n\n# after\nPuppet::Util::Windows::ADSI::User.exists?('DOMAIN\\\\bob')","handlingStrategy":"validation","validationCode":"raise ArgumentError, \"ADSI names must use DOMAIN\\\\account, got #{name.inspect}\" if name.include?('/')\nname = name.tr('/', '\\\\\\\\') # normalize accidental forward slashes\nPuppet::Util::Windows::ADSI::User.exists?(name)","typeGuard":"def valid_adsi_name?(n)\n  n.is_a?(String) && !n.empty? && !n.include?('/')\nend","tryCatchPattern":null,"preventionTips":["Prefer bare local account names in resources.","Never feed DNs or WinNT:// URIs to name-based ADSI helpers.","Assert no '/' in programmatically generated names."],"tags":["puppet","windows","adsi","account-name","validation"],"backgroundTag":"invalid-account-name-format","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}