{"record":{"id":"bee416eae1a5b6a4","repo":"puppetlabs/puppet","slug":"invalid-recurse-value-value","errorCode":null,"errorMessage":"Invalid recurse value %{value}","messagePattern":"Invalid recurse value %(.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/type/tidy.rb","lineNumber":52,"sourceCode":"    desc \"If target is a directory, recursively descend\n      into the directory looking for files to tidy. Numeric values\n      specify a limit for the recursion depth, `true` means\n      unrestricted recursion.\"\n\n    newvalues(:true, :false, :inf, /^[0-9]+$/)\n\n    # Replace the validation so that we allow numbers in\n    # addition to string representations of them.\n    validate { |arg| }\n    munge do |value|\n      newval = super(value)\n      case newval\n      when :true, :inf; true\n      when :false; false\n      when Integer; value\n      when /^\\d+$/; Integer(value)\n      else\n        raise ArgumentError, _(\"Invalid recurse value %{value}\") % { value: value.inspect }\n      end\n    end\n  end\n\n  newparam(:max_files) do\n    desc \"In case the resource is a directory and the recursion is enabled, puppet will\n      generate a new resource for each file file found, possible leading to\n      an excessive number of resources generated without any control.\n\n      Setting `max_files` will check the number of file resources that\n      will eventually be created and will raise a resource argument error if the\n      limit will be exceeded.\n\n      Use value `0` to disable the check. In this case, a warning is logged if\n      the number of files exceeds 1000.\"\n\n    defaultto 0\n    newvalues(/^[0-9]+$/)","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/type/tidy.rb#L34-L70","documentation":"tidy's `recurse` parameter deliberately replaces the inherited validation with a no-op (`validate { |arg| }`) and re-implements it in munge (lib/puppet/type/tidy.rb:52): true/false/inf become booleans, Integers and digit-only strings become a depth limit; everything else raises ArgumentError \"Invalid recurse value\". Unlike file's recurse, 'remote'/'local' are NOT accepted.","triggerScenarios":"`tidy { '/var/tmp': recurse => 'remote' }` (valid on file resources, invalid on tidy); `recurse => 'yes'`; `recurse => 1.5`; symbols.","commonSituations":"Copying recurse => remote from file resources; expecting boolean synonyms ('yes'/'no'); tidy examples confused with file's vocabulary.","solutions":["Use `true`/`false`, `inf`, or an integer depth (e.g. recurse => 2)","Use recurse => true or inf for unlimited depth","Remember tidy has no 'remote' recursion — that is file-only vocabulary"],"exampleFix":"# before\ntidy { '/var/opt/app/tmp':\n  recurse => 'yes',\n}\n\n# after\ntidy { '/var/opt/app/tmp':\n  recurse => true,\n}","handlingStrategy":"validation","validationCode":"if $recurse != undef and !($recurse =~ /\\A\\d+\\z/ or $recurse in [true, false, 'true', 'false', 'inf']) {\n  fail(\"tidy recurse must be true/false/inf or an integer, got '${recurse}'\")\n}","typeGuard":"def valid_tidy_recurse?(v)\n  v == true || v == false || v.is_a?(Integer) ||\n    %w[true false inf].include?(v.to_s) || v.to_s =~ /\\A\\d+\\z/\nend","tryCatchPattern":"begin\n  Puppet::Type.type(:tidy).new(path: '/tmp/x', recurse: 'remote')\nrescue ArgumentError => e\n  raise unless e.message.include?('recurse')\n  # substitute true/inf or an integer depth\nend","preventionTips":["tidy's recurse vocabulary differs from file's — no remote/local","Lint manifests copying file options onto tidy","Use integers to cap depth and avoid huge catalogs (see max_files)"],"tags":["puppet","tidy","recurse","invalid-value"],"backgroundTag":"invalid-parameter-value","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}