{"record":{"id":"363d092e93cb037b","repo":"puppetlabs/puppet","slug":"an-uri-can-only-be-merged-with-an-uri-or-string","errorCode":null,"errorMessage":"An URI can only be merged with an URI or String","messagePattern":"An URI can only be merged with an URI or String","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/evaluator/evaluator_impl.rb","lineNumber":1239,"sourceCode":"          when Array\n            # Hash[[a, 1, b, 2]] => {}\n            # Hash[a,1,b,2] => {a => 1, b => 2}\n            # Hash[[a,1], [b,2]] => {[a,1] => [b,2]}\n            # Hash[[[a,1], [b,2]]] => {a => 1, b => 2}\n            # Use type calculator to determine if array is Array[Array[?]], and if so use second form\n            # of call\n            t = @@type_calculator.infer(y)\n            if t.element_type.is_a? Types::PArrayType\n              y.to_h\n            else\n              Hash[*y]\n            end\n          else\n            raise ArgumentError, _('Can only append Array or Hash to a Hash')\n          end\n      x.merge y # new hash with overwrite\n    when URI\n      raise ArgumentError, _('An URI can only be merged with an URI or String') unless y.is_a?(String) || y.is_a?(URI)\n\n      x + y\n    when Types::PBinaryType::Binary\n      raise ArgumentError, _('Can only append Binary to a Binary') unless y.is_a?(Types::PBinaryType::Binary)\n\n      Types::PBinaryType::Binary.from_binary_string(x.binary_buffer + y.binary_buffer)\n    else\n      concatenate([x], y)\n    end\n  end\n\n  # Produces the result x \\ y (set difference)\n  # When `x` is an Array, `y` is transformed to an array and then all matching elements removed from x.\n  # When `x` is a Hash, all contained keys are removed from x as listed in `y` if it is an Array, or all its keys if it is a Hash.\n  # The difference is returned. The given `x` and `y` are not modified by this operation.\n  # @raise [ArgumentError] when `x` is neither an Array nor a Hash\n  #\n  def delete(x, y)","sourceCodeStart":1221,"sourceCodeEnd":1257,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/evaluator/evaluator_impl.rb#L1221-L1257","documentation":"Error \"An URI can only be merged with an URI or String\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/pops/evaluator/evaluator_impl.rb:1239 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"}