{"record":{"id":"96876e99b76b63bc","repo":"mongodb/mongoid","slug":"invalid-value-for-operator-name-argument-nega-96876e","errorCode":null,"errorMessage":"Invalid value for $#{operator_name} argument: negative numbers are not allowed: #{condition}","messagePattern":"Invalid value for \\$#(.+?) argument: negative numbers are not allowed: #(.+?)","errorType":"exception","errorClass":"Mongoid::Errors::InvalidQuery","httpStatus":null,"severity":"error","filePath":"lib/mongoid/matcher/bits.rb","lineNumber":41,"sourceCode":"        when Array\n          array_matches?(value, condition)\n        when BSON::Binary\n          int_cond = condition.data.split('').map { |n| '%02x' % n.ord }.join.to_i(16)\n          int_matches?(value, int_cond)\n        when Integer\n          if condition < 0\n            raise Errors::InvalidQuery,\n                  \"Invalid value for $#{operator_name} argument: negative integers are not allowed: #{condition}\"\n          end\n\n          int_matches?(value, condition)\n        when Float\n          # Allow floats that are whole numbers (e.g. 50.0), but reject those\n          # with a fractional part (e.g. 50.1) since bitwise ops require integers.\n          int_cond = condition.to_i\n          if int_cond == condition\n            if int_cond < 0\n              raise Errors::InvalidQuery,\n                    \"Invalid value for $#{operator_name} argument: negative numbers are not allowed: #{condition}\"\n            end\n\n            int_matches?(value, int_cond)\n          else\n            raise Errors::InvalidQuery,\n                  \"Invalid type for $#{operator_name} argument: not representable as an integer: #{condition}\"\n          end\n        else\n          raise Errors::InvalidQuery, \"Invalid type for $#{operator_name} argument: #{condition}\"\n        end\n      end\n\n      # Returns the name of the expression operator.\n      #\n      # @return [ String ] The operator name.\n      #\n      # @api private","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/matcher/bits.rb#L23-L59","documentation":"Error \"Invalid value for $#{operator_name} argument: negative numbers are not allowed: #{condition}\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/matcher/bits.rb:41 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":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}