ruby/rubygems · error · SourceConflict

Source(s) `#{sources.join("`, `")}` declared by #{plugin} ar

Error message

Source(s) `#{sources.join("`, `")}` declared by #{plugin} are already registered.

What it means

Error "Source(s) `#{sources.join("`, `")}` declared by #{plugin} are already registered." thrown in ruby/rubygems.

Source

Thrown at lib/bundler/plugin/index.rb:62

      # This function is to be called when a new plugin is installed. This
      # function shall add the functions of the plugin to existing maps and also
      # the name to source location.
      #
      # @param [String] name of the plugin to be registered
      # @param [String] path where the plugin is installed
      # @param [Array<String>] load_paths for the plugin
      # @param [Array<String>] commands that are handled by the plugin
      # @param [Array<String>] sources that are handled by the plugin
      def register_plugin(name, path, load_paths, commands, sources, hooks)
        old_commands = @commands.dup

        common = commands & @commands.keys
        raise CommandConflict.new(name, common) unless common.empty?
        commands.each {|c| @commands[c] = name }

        common = sources & @sources.keys
        raise SourceConflict.new(name, common) unless common.empty?
        sources.each {|k| @sources[k] = name }

        hooks.each do |event|
          event_hooks = (@hooks[event] ||= []) << name
          event_hooks.uniq!
        end

        @plugin_paths[name] = path
        @load_paths[name] = load_paths
        save_index
      rescue StandardError
        @commands = old_commands
        raise
      end

      def unregister_plugin(name)
        @commands.delete_if {|_, v| v == name }
        @sources.delete_if {|_, v| v == name }

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/plugin/index.rb:62 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/2c376d737a9f252f. Report an issue: GitHub.