puppetlabs/puppet · error · ArgumentError

The hash given as 'merge' must contain the name of a strateg

Error message

The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'

What it means

Error "The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/pops/merge_strategy.rb:30

      @@strategies ||= {}
    end
    private_class_method :strategies

    # Finds the merge strategy for the given _merge_, creates an instance of it and returns that instance.
    #
    # @param merge [MergeStrategy,String,Hash<String,Object>,nil] The merge strategy. Can be a string or symbol denoting the key
    #   identifier or a hash with options where the key 'strategy' denotes the key
    # @return [MergeStrategy] The matching merge strategy
    #
    def self.strategy(merge)
      return DefaultMergeStrategy::INSTANCE unless merge
      return merge if merge.is_a?(MergeStrategy)

      if merge.is_a?(Hash)
        merge_strategy = merge['strategy']
        if merge_strategy.nil?
          # TRANSLATORS 'merge' is a variable name and 'strategy' is a key and should not be translated
          raise ArgumentError, _("The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'")
        end

        merge_options  = merge.size == 1 ? EMPTY_HASH : merge
      else
        merge_strategy = merge
        merge_options = EMPTY_HASH
      end
      merge_strategy = merge_strategy.to_sym if merge_strategy.is_a?(String)
      strategy_class = strategies[merge_strategy]
      raise ArgumentError, _("Unknown merge strategy: '%{strategy}'") % { strategy: merge_strategy } if strategy_class.nil?

      merge_options == EMPTY_HASH ? strategy_class::INSTANCE : strategy_class.new(merge_options)
    end

    # Returns the list of merge strategy keys known to this class
    #
    # @return [Array<Symbol>] List of strategy keys
    #

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/pops/merge_strategy.rb:30 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/bd2f2d28a3b74092. Report an issue: GitHub.