{"record":{"id":"ec3cb39256b95ff8","repo":"puppetlabs/puppet","slug":"invalid-hold-value-value-doc","errorCode":null,"errorMessage":"Invalid hold value %{value}. %{doc}","messagePattern":"Invalid hold value %(.+?)\\. %(.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/type/package.rb","lineNumber":684,"sourceCode":"      desc <<-EOT\n        Set to hold to tell Debian apt/Solaris pkg to hold the package version\n\n        #{mark_doc}\n        Default is \"none\". Mark can be specified with or without `ensure`,\n        if `ensure` is missing will default to \"present\".\n\n        Mark cannot be specified together with \"purged\", or \"absent\"\n        values for `ensure`.\n      EOT\n      newvalues(:hold, :none)\n      munge do |value|\n        case value\n        when \"hold\", :hold\n          :hold\n        when \"none\", :none\n          :none\n        else\n          raise ArgumentError, _('Invalid hold value %{value}. %{doc}') % { value: value.inspect, doc: mark_doc }\n        end\n      end\n\n      def insync?(is)\n        @should[0] == is\n      end\n\n      def should\n        @should[0] if @should && @should.is_a?(Array) && @should.size == 1\n      end\n\n      def retrieve\n        provider.properties[:mark]\n      end\n\n      def sync\n        if @should[0] == :hold\n          provider.hold","sourceCodeStart":666,"sourceCodeEnd":702,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/type/package.rb#L666-L702","documentation":"The package type's `mark` property manages hold/pin state and only accepts the values `hold` or `none` (newvalues + munge in lib/puppet/type/package.rb:684). Any other value — 'held', true, 'unhold', symbols, hashes — falls into the munge's else branch and raises ArgumentError with the value inspected plus the mark documentation text.","triggerScenarios":"Writing `package { 'nginx': mark => 'held' }`, `mark => true`, `mark => 'hold '` (trailing space), or programmatically `Puppet::Type.type(:package).new(name: 'x', mark: 'frozen')`.","commonSituations":"Users arriving from `apt-mark hold` writing 'held'; users confusing provider-specific words ('frozen', 'pinned', 'locked'); manifests migrated from ancient `ensure => held` syntax that must become `mark => hold` after upgrades.","solutions":["Use exactly `mark => hold` or `mark => none`","If you were migrating old `ensure => held` syntax, replace it with `mark => hold` (held is no longer an ensure value)","Type the variable in your module data as Enum['hold', 'none'] so invalid data fails earlier with a clearer message"],"exampleFix":"# before\npackage { 'nginx':\n  ensure => installed,\n  mark   => 'held',\n}\n\n# after\npackage { 'nginx':\n  ensure => installed,\n  mark   => hold,\n}","handlingStrategy":"validation","validationCode":"if $mark != undef and $mark !~ /^(hold|none)$/ {\n  fail(\"package mark must be 'hold' or 'none', got '${mark}'\")\n}","typeGuard":"def valid_mark?(value)\n  %w[hold none].include?(value.to_s)\nend","tryCatchPattern":"begin\n  Puppet::Type.type(:package).new(name: 'nginx', ensure: :installed, mark: 'held')\nrescue ArgumentError => e\n  raise unless e.message.include?('Invalid hold value')\n  # normalize to :hold/:none and retry construction once\nend","preventionTips":["Remember the allowed set is only hold/none","Declare Puppet data types (Enum['hold','none']) on profile parameters","Don't pass raw provider CLI words to mark"],"tags":["puppet","package","invalid-value","hold","apt"],"backgroundTag":"invalid-parameter-value","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}