{"record":{"id":"89a5d040f35f9c43","repo":"puppetlabs/puppet","slug":"group-names-must-not-be-empty-if-you-want-to-spec","errorCode":null,"errorMessage":"Group names must not be empty. If you want to specify \"no groups\" pass an empty array","messagePattern":"Group names must not be empty\\. If you want to specify \"no groups\" pass an empty array","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/type/user.rb","lineNumber":350,"sourceCode":"\n      validate do |value|\n        if value.to_s !~ /^-?\\d+$/\n          raise ArgumentError, \"Password warning days must be provided as a number.\"\n        end\n      end\n    end\n\n    newproperty(:groups, :parent => Puppet::Property::List) do\n      desc \"The groups to which the user belongs.  The primary group should\n        not be listed, and groups should be identified by name rather than by\n        GID.  Multiple groups should be specified as an array.\"\n\n      validate do |value|\n        if value =~ /^\\d+$/\n          raise ArgumentError, _(\"Group names must be provided, not GID numbers.\")\n        end\n        raise ArgumentError, _(\"Group names must be provided as an array, not a comma-separated list.\") if value.include?(\",\")\n        raise ArgumentError, _(\"Group names must not be empty. If you want to specify \\\"no groups\\\" pass an empty array\") if value.empty?\n      end\n\n      def change_to_s(currentvalue, newvalue)\n        newvalue = newvalue.split(\",\") if newvalue != :absent\n\n        if provider.respond_to?(:groups_to_s)\n          # for Windows ADSI\n          # de-dupe the \"newvalue\" when the sync event message is generated,\n          # due to final retrieve called after the resource has been modified\n          newvalue = provider.groups_to_s(newvalue).split(',').uniq\n        end\n\n        super(currentvalue, newvalue)\n      end\n\n      # override Puppet::Property::List#retrieve\n      def retrieve\n        if provider.respond_to?(:groups_to_s)","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/type/user.rb#L332-L368","documentation":"Raised by the validate block of the `groups` property on the `user` type when a member string is empty. An empty string cannot name a group, and Puppet cannot tell it apart from an accidental value, so the error message tells you to pass an explicit empty array when the intent is 'no supplementary groups'.","triggerScenarios":"`user { 'alice': groups => '' }` or an array containing '' (e.g. from a join/split round-trip or an undefined template variable interpolated to empty); a class parameter defaulting to '' instead of undef.","commonSituations":"ERB/EPP templates interpolating an unset variable; data pipelines that produce empty strings for 'no value'; splitting an empty string (''.split(',') yields []) is safe but literal '' in data is not.","solutions":["Pass an explicit empty array for no groups: `groups => []`","Or omit the attribute entirely when you have no opinion about supplementary groups","Fix upstream data/templates to emit undef instead of ''"],"exampleFix":"# before\nuser { 'alice':\n  ensure => present,\n  groups => '',\n}\n\n# after\nuser { 'alice':\n  ensure => present,\n  groups => [],   # explicitly no supplementary groups\n}","handlingStrategy":"validation","validationCode":"# In profiles, translate empty scalars into 'no groups' explicitly\n$groups = $raw_groups ? {\n  String  => $raw_groups.empty? ? [] : $raw_groups.split(',')\n  default => $raw_groups,\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use undef (not '') for 'no value' in class parameters","Pass [] when the intent is explicitly zero supplementary groups","Check EPP/ERB templates for interpolated unset variables feeding groups"],"tags":["puppet","user-resource","groups","empty-value"],"backgroundTag":"empty-value-rejected","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}