ruby/rubygems · error · InvalidArgumentError

GitHub sources require a block

Error message

GitHub sources require a block

What it means

Error "GitHub sources require a block" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/dsl.rb:191

    end

    def git(uri, options = {}, &blk)
      unless block_given?
        msg = "You can no longer specify a git source by itself. Instead, \n" \
              "either use the :git option on a gem, or specify the gems that \n" \
              "bundler should find in the git source by passing a block to \n" \
              "the git method, like: \n\n" \
              "  git 'git://github.com/rails/rails.git' do\n" \
              "    gem 'rails'\n" \
              "  end"
        raise DeprecatedError, msg
      end

      with_source(@sources.add_git_source(normalize_hash(options).merge("uri" => uri)), &blk)
    end

    def github(repo, options = {})
      raise InvalidArgumentError, "GitHub sources require a block" unless block_given?
      github_uri  = @git_sources["github"].call(repo)
      git_options = normalize_hash(options).merge("uri" => github_uri)
      git_source  = @sources.add_git_source(git_options)
      with_source(git_source) { yield }
    end

    SUPPORTED_OVERRIDE_FIELDS = [:version, :required_ruby_version, :required_rubygems_version].freeze
    SUPPORTED_OVERRIDE_SYMBOL_OPERATIONS = [:ignore_upper].freeze

    def override(target, **operations)
      validate_override_target!(target)

      if target == :all && operations.key?(:version)
        raise ArgumentError, "`override :all, version:` is not allowed; version requirements are per-gem"
      end

      operations.each do |field, operation|
        validate_override_field!(field)

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/dsl.rb:191 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/5d61d690b245a317. Report an issue: GitHub.