{"record":{"id":"7d18e9fb5841aa2c","repo":"puppetlabs/puppet","slug":"can-only-delete-from-an-array-or-hash","errorCode":null,"errorMessage":"Can only delete from an Array or Hash.","messagePattern":"Can only delete from an Array or Hash\\.","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/evaluator/evaluator_impl.rb","lineNumber":1275,"sourceCode":"  def delete(x, y)\n    result = x.dup\n    case x\n    when Array\n      y = case y\n          when Array then y\n          when Hash  then y.to_a\n          else            [y]\n          end\n      y.each { |e| result.delete(e) }\n    when Hash\n      y = case y\n          when Array then y\n          when Hash  then y.keys\n          else            [y]\n          end\n      y.each { |e| result.delete(e) }\n    else\n      raise ArgumentError, _(\"Can only delete from an Array or Hash.\")\n    end\n    result\n  end\n\n  # Implementation of case option matching.\n  #\n  # This is the type of matching performed in a case option, using == for every type\n  # of value except regular expression where a match is performed.\n  #\n  def is_match?(left, right, o, option_expr, scope)\n    @@compare_operator.match(left, right, scope)\n  end\n\n  # Maps the expression in the given array to their product except for UnfoldExpressions which are first unfolded.\n  # The result is added to the given result Array.\n  # @param result [Array] Where to add the result (may contain information to add to)\n  # @param array [Array[Model::Expression] the expressions to map\n  # @param scope [Puppet::Parser::Scope] the scope to evaluate in","sourceCodeStart":1257,"sourceCodeEnd":1293,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/evaluator/evaluator_impl.rb#L1257-L1293","documentation":"Error \"Can only delete from an Array or Hash.\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/pops/evaluator/evaluator_impl.rb:1275 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"}