ruby/rubygems · error · InvalidOption

Expected `cooldown` to be a non-negative integer, got #{cool

Error message

Expected `cooldown` to be a non-negative integer, got #{cooldown.inspect}

What it means

Error "Expected `cooldown` to be a non-negative integer, got #{cooldown.inspect}" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/dsl.rb:122

      add_dependency(name, version, options)
    end

    # For usage in Dsl.evaluate, since lockfile is used as part of the Gemfile.
    def lockfile_path
      @lockfile
    end

    def lockfile(file)
      @lockfile = file
    end

    def source(source, *args, &blk)
      options = args.last.is_a?(Hash) ? args.pop.dup : {}
      options = normalize_hash(options)
      source = normalize_source(source)
      cooldown = options["cooldown"]
      if cooldown && !(cooldown.is_a?(Integer) && cooldown >= 0)
        raise InvalidOption, "Expected `cooldown` to be a non-negative integer, got #{cooldown.inspect}"
      end

      if options.key?("type")
        options["type"] = options["type"].to_s
        unless (source_plugin = Plugin.source_plugin(options["type"]))
          raise InvalidOption, "No plugin sources available for #{options["type"]}"
        end
        # Implicitly add a dependency on source plugins who are named bundler-source-<type>,
        # and aren't already mentioned in the Gemfile.
        # See also Plugin::DSL#source
        if source_plugin.start_with?("bundler-source-") && !@dependencies.any? {|d| d.name == source_plugin }
          plugin(source_plugin)
        end

        unless block_given?
          raise InvalidOption, "You need to pass a block to #source with :type option"
        end

View on GitHub (pinned to 86cbb817a3)

When it happens

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