{"record":{"id":"bd2f2d28a3b74092","repo":"puppetlabs/puppet","slug":"the-hash-given-as-merge-must-contain-the-name-of","errorCode":null,"errorMessage":"The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'","messagePattern":"The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/merge_strategy.rb","lineNumber":30,"sourceCode":"      @@strategies ||= {}\n    end\n    private_class_method :strategies\n\n    # Finds the merge strategy for the given _merge_, creates an instance of it and returns that instance.\n    #\n    # @param merge [MergeStrategy,String,Hash<String,Object>,nil] The merge strategy. Can be a string or symbol denoting the key\n    #   identifier or a hash with options where the key 'strategy' denotes the key\n    # @return [MergeStrategy] The matching merge strategy\n    #\n    def self.strategy(merge)\n      return DefaultMergeStrategy::INSTANCE unless merge\n      return merge if merge.is_a?(MergeStrategy)\n\n      if merge.is_a?(Hash)\n        merge_strategy = merge['strategy']\n        if merge_strategy.nil?\n          # TRANSLATORS 'merge' is a variable name and 'strategy' is a key and should not be translated\n          raise ArgumentError, _(\"The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'\")\n        end\n\n        merge_options  = merge.size == 1 ? EMPTY_HASH : merge\n      else\n        merge_strategy = merge\n        merge_options = EMPTY_HASH\n      end\n      merge_strategy = merge_strategy.to_sym if merge_strategy.is_a?(String)\n      strategy_class = strategies[merge_strategy]\n      raise ArgumentError, _(\"Unknown merge strategy: '%{strategy}'\") % { strategy: merge_strategy } if strategy_class.nil?\n\n      merge_options == EMPTY_HASH ? strategy_class::INSTANCE : strategy_class.new(merge_options)\n    end\n\n    # Returns the list of merge strategy keys known to this class\n    #\n    # @return [Array<Symbol>] List of strategy keys\n    #","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/merge_strategy.rb#L12-L48","documentation":"Error \"The hash given as 'merge' must contain the name of a strategy in string form for the key 'strategy'\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/pops/merge_strategy.rb:30 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}