ruby/rubygems · error · Bundler::InvalidOption

Unknown option`--format=#{@format}`. Supported formats: `jso

Error message

Unknown option`--format=#{@format}`. Supported formats: `json`

What it means

Error "Unknown option`--format=#{@format}`. Supported formats: `json`" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/cli/list.rb:37

      specs = if @only_group.any? || @without_group.any?
        filtered_specs_by_groups
      else
        begin
          Bundler.load.specs
        rescue GemNotFound => e
          Bundler.ui.error e.message
          Bundler.ui.warn "Install missing gems with `bundle install`."
          exit 1
        end
      end.reject {|s| s.name == "bundler" }.sort_by(&:name)

      case @format
      when "json"
        print_json(specs: specs)
      when nil
        print_human(specs: specs)
      else
        raise InvalidOption, "Unknown option`--format=#{@format}`. Supported formats: `json`"
      end
    end

    private

    def print_json(specs:)
      gems = if @options["name-only"]
        specs.map {|s| { name: s.name } }
      else
        specs.map do |s|
          {
            name: s.name,
            version: s.version.to_s,
            git_version: s.git_version&.strip,
          }.tap do |h|
            h[:path] = s.full_gem_path if @options["paths"]
          end
        end

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/cli/list.rb:37 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/6000daa703b4b127. Report an issue: GitHub.