{"record":{"id":"90b2cd25f6b45951","repo":"puppetlabs/puppet","slug":"the-umask-specification-is-invalid-value","errorCode":null,"errorMessage":"The umask specification is invalid: %{value}","messagePattern":"The umask specification is invalid: %(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/type/exec.rb","lineNumber":322,"sourceCode":"\n      validate do |values|\n        values = [values] unless values.is_a? Array\n        values.each do |value|\n          unless value =~ /\\w+=/\n            raise ArgumentError, _(\"Invalid environment setting '%{value}'\") % { value: value }\n          end\n        end\n      end\n    end\n\n    newparam(:umask, :required_feature => :umask) do\n      desc \"Sets the umask to be used while executing this command\"\n\n      munge do |value|\n        if value =~ /^0?[0-7]{1,4}$/\n          return value.to_i(8)\n        else\n          raise Puppet::Error, _(\"The umask specification is invalid: %{value}\") % { value: value.inspect }\n        end\n      end\n    end\n\n    newparam(:timeout) do\n      desc \"The maximum time the command should take.  If the command takes\n        longer than the timeout, the command is considered to have failed\n        and will be stopped. The timeout is specified in seconds. The default\n        timeout is 300 seconds and you can set it to 0 to disable the timeout.\"\n\n      munge do |value|\n        value = value.shift if value.is_a?(Array)\n        begin\n          value = Float(value)\n        rescue ArgumentError => e\n          raise ArgumentError, _(\"The timeout must be a number.\"), e.backtrace\n        end\n        [value, 0.0].max","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/type/exec.rb#L304-L340","documentation":"The exec type's umask parameter (only honored for providers with the umask feature) munges its value by matching ^0?[0-7]{1,4}$ — an optional leading zero plus one to four octal digits. Anything else (digits 8/9, '0o022' notation, five-plus digits, arbitrary strings) raises Puppet::Error 'The umask specification is invalid' with the inspected value, failing validation before the run.","triggerScenarios":"exec { 'x': umask => '0778' } (invalid octal digit); umask => '0o022' (Ruby-style literal); umask => '002277' (too long); values arriving from hiera as strings like 'umask 022'. Note valid examples: '022', '0022', '77', 22 (integer munged via regex).","commonSituations":"Copy-pasting shell syntax ('umask 022') into the parameter; YAML config quoting octals as '0o...' (YAML 1.2 style) or letting YAML coerce 022 to octal 18 then re-stringify oddly; team conventions disagreeing on 3 vs 4 digit masks.","solutions":["Use one to four octal digits with optional leading zero: umask => '0022'","Quote YAML values to avoid YAML 1.1 octal coercion surprises: umask: \"0022\"","Strip shell syntax from data: 'umask 022' -> '022'","If the value is dynamic, validate first in Ruby: value.match?(/\\A0?[0-7]{1,4}\\z/)"],"exampleFix":"# before\nexec { 'build': command => '/bin/build', umask => '0o022' } # => Puppet::Error\n\n# after\nexec { 'build': command => '/bin/build', umask => '0022' }","handlingStrategy":"validation","validationCode":"value = value.shift if value.is_a?(Array)\nraise Puppet::Error, \"bad umask #{value}\" unless value.to_s.match?(/\\A0?[0-7]{1,4}\\z/)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 3-4 octal digits only ('0022'), never '0o' notation or shell syntax","Quote octal-looking values in YAML to avoid coercion surprises","Lint hiera data for umask keys matching the octal pattern"],"tags":["puppet","exec","umask","octal","attribute-format"],"backgroundTag":"invalid-attribute-format","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}