ruby/rubygems · error · Bundler::APIResponseMismatchError

34

34

Error message

Downloading #{spec.full_name} revealed dependencies not in the API (#{extra_deps.join(", ")}).
Running `bundle update #{spec.name}` should fix the problem.

What it means

Error "Downloading #{spec.full_name} revealed dependencies not in the API (#{extra_deps.join(", ")}). Running `bundle update #{spec.name}` should fix the problem." thrown in ruby/rubygems.

Source

Thrown at lib/bundler/shared_helpers.rb:166

      message = "Multiple gemfiles (gems.rb and Gemfile) detected. " \
                "Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.locked."
      Bundler.ui.warn message
    end

    def ensure_same_dependencies(spec, old_deps, new_deps)
      new_deps = new_deps.reject {|d| d.type == :development }
      old_deps = old_deps.reject {|d| d.type == :development }

      without_type = proc {|d| Gem::Dependency.new(d.name, d.requirements_list.sort) }
      new_deps.map!(&without_type)
      old_deps.map!(&without_type)

      extra_deps = new_deps - old_deps
      return if extra_deps.empty?

      Bundler.ui.debug "#{spec.full_name} from #{spec.remote} has corrupted API dependencies" \
        " (was expecting #{old_deps.map(&:to_s)}, but the real spec has #{new_deps.map(&:to_s)})"
      raise APIResponseMismatchError,
        "Downloading #{spec.full_name} revealed dependencies not in the API (#{extra_deps.join(", ")})." \
        "\nRunning `bundle update #{spec.name}` should fix the problem."
    end

    def pretty_dependency(dep)
      msg = String.new(dep.name)
      msg << " (#{dep.requirement})" unless dep.requirement == Gem::Requirement.default

      if dep.is_a?(Bundler::Dependency)
        platform_string = dep.platforms.join(", ")
        msg << " " << platform_string if !platform_string.empty? && platform_string != Gem::Platform::RUBY
      end

      msg
    end

    def md5_available?
      return @md5_available if defined?(@md5_available)

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/shared_helpers.rb:166 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23). Data as JSON: /api/errors/ee016b2a7fdb1498. Report an issue: GitHub.