{"record":{"id":"023b77bb3d3dbdb4","repo":"ruby/rubygems","slug":"4","errorCode":"4","errorMessage":"The #{name} dependency has conflicting requirements in Gemfile (#{gemfile_dep.requirement}) and gemspec (#{gemspec_dep.requirement})","messagePattern":"The #(.+?) dependency has conflicting requirements in Gemfile \\(#(.+?)\\) and gemspec \\(#(.+?)\\)","errorType":"validation","errorClass":"GemfileError","httpStatus":null,"severity":"error","filePath":"lib/bundler/dsl.rb","lineNumber":345,"sourceCode":"      # if there's already a dependency with this name we try to prefer one\n      if current = @dependencies.find {|d| d.name == name }\n        if current.requirement != dep.requirement\n          current_requirement_open = current.requirements_list.include?(\">= 0\")\n\n          gemspec_dep = [dep, current].find(&:gemspec_dev_dep?)\n          if gemspec_dep\n            require_relative \"vendored_pub_grub\"\n\n            current_gemspec_range = Gem::PubGrub::RubyGems.requirement_to_range(current.requirement)\n            next_gemspec_range = Gem::PubGrub::RubyGems.requirement_to_range(dep.requirement)\n\n            if current_gemspec_range.intersects?(next_gemspec_range)\n              dep = Dependency.new(name, current.requirement.as_list + dep.requirement.as_list, options)\n            else\n              gemfile_dep = [dep, current].find(&:gemfile_dep?)\n\n              if gemfile_dep\n                raise GemfileError, \"The #{name} dependency has conflicting requirements in Gemfile (#{gemfile_dep.requirement}) and gemspec (#{gemspec_dep.requirement})\"\n              else\n                raise GemfileError, \"Two gemspec development dependencies have conflicting requirements on the same gem: #{dep} and #{current}\"\n              end\n            end\n          else\n            update_prompt = \"\"\n\n            if File.basename(@gemfile) == Injector::INJECTED_GEMS\n              if dep.requirements_list.include?(\">= 0\") && !current_requirement_open\n                update_prompt = \". Gem already added\"\n              else\n                update_prompt = \". If you want to update the gem version, run `bundle update #{name}`\"\n\n                update_prompt += \". You may also need to change the version requirement specified in the Gemfile if it's too restrictive.\" unless current_requirement_open\n              end\n            end\n\n            raise GemfileError, \"You cannot specify the same gem twice with different version requirements.\\n\" \\","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/bundler/dsl.rb#L327-L363","documentation":"Error \"The #{name} dependency has conflicting requirements in Gemfile (#{gemfile_dep.requirement}) and gemspec (#{gemspec_dep.requirement})\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/bundler/dsl.rb:345 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":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}