ruby/rubygems · error · Bundler::MarshalError

Specs #{name} from #{remote} is expected to be an Array but

Error message

Specs #{name} from #{remote} is expected to be an Array but was unexpected class #{specs.class}

What it means

Error "Specs #{name} from #{remote} is expected to be an Array but was unexpected class #{specs.class}" thrown in ruby/rubygems.

Source

Thrown at lib/bundler/rubygems_integration.rb:365

      redefine_method(gem_class, :load_plugins) do |*|
        load_plugin_files specs.flat_map(&:plugins)
      end
    end

    def plain_specs
      Gem::Specification._all
    end

    def plain_specs=(specs)
      Gem::Specification.all = specs
    end

    def fetch_specs(remote, name, fetcher)
      require "rubygems/remote_fetcher"
      path = remote.uri.to_s + "#{name}.#{Gem.marshal_version}.gz"
      string = fetcher.fetch_path(path)
      specs = Bundler.safe_load_marshal(string)
      raise MarshalError, "Specs #{name} from #{remote} is expected to be an Array but was unexpected class #{specs.class}" unless specs.is_a?(Array)
      specs
    rescue Gem::RemoteFetcher::FetchError
      # it's okay for prerelease to fail
      raise unless name == "prerelease_specs"
    end

    def fetch_all_remote_specs(remote, gem_remote_fetcher)
      specs = fetch_specs(remote, "specs", gem_remote_fetcher)
      pres = fetch_specs(remote, "prerelease_specs", gem_remote_fetcher) || []

      specs.concat(pres)
    end

    def download_gem(spec, uri, cache_dir, fetcher)
      require "rubygems/remote_fetcher"
      uri = Bundler.settings.mirror_for(uri)
      redacted_uri = Gem::Uri.redact(uri)

View on GitHub (pinned to 86cbb817a3)

When it happens

Trigger: Thrown at lib/bundler/rubygems_integration.rb:365 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/ec6d1d7ad15a8362. Report an issue: GitHub.