Rubygems: incompatible marshal file format (format version 4.8 required; 60.33 given)

Created on 21 Apr 2016  路  13Comments  路  Source: rubygems/rubygems

I'm having a problem.

My current problem is:

# gem install bundler
ERROR:  While executing gem ... (TypeError)
    incompatible marshal file format (can't be read)
    format version 4.8 required; 60.33 given

This issue is related to:

  • [ ] Network problems
  • [x] Installing a library
  • [ ] Publishing a library
  • [ ] The command line gem
  • [ ] Other

Here are my current envrionment details:

ruby --version

ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]

uname -a

Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ gem env version
2.6.3

any help?

thx.

Most helpful comment

It seems bundler can't find sources for your gem.
It's probably because the remote sources are outdated. You can check your remote sources with gem env. I think the last of these old sources has now become unavailable:

  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
     - http://gems.github.com

Since these are outdated, you should add https://rubygems.org as a source now to the gem env config. You can update the config with the following commands:

gem sources -r http://gems.rubyforge.org/
gem sources -r http://gems.github.com
gem sources -a https://rubygems.org/

When updated, gem sources -lshould return:

*** CURRENT SOURCES ***

https://rubygems.org/

Credits go to https://qiita.com/hidehiro98/items/bb6ed9bc109021034af0

All 13 comments

@keykin Could not reproduce the error with the details you provide, I'm going to close this, please re-open if this is still an issue for you.

I have the same error,,,
Ruby version: 2.4.1

gem env version
2.6.11

Same ! Ruby -v 2.5.3p105

Same ! Ruby -v 2.5.3p105

What's going on here? Can someone run the command with the --backtrace, --debug and --verbose flags to give us more information?

$ gem install bundler --backtrace --debug --verbose
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/resolv.rb:170 - LoadError
HEAD http://gems.rubyforge.org/api/v1/dependencies
301 Moved Permanently
HEAD https://rubygems.org
200 OK
HEAD http://gems.github.com/api/v1/dependencies
301 Moved Permanently
HEAD http://gems.github.io/api/v1/dependencies
404 Not Found
Exception `Gem::RemoteFetcher::FetchError' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/remote_fetcher.rb:244 - bad response Not Found 404 (http://gems.github.io/api/v1/dependencies)
Exception `Gem::RemoteFetcher::FetchError' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/remote_fetcher.rb:274 - bad response Not Found 404 (http://gems.github.io/api/v1/dependencies)
Exception `Errno::EEXIST' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/fileutils.rb:239 - File exists @ dir_s_mkdir - /Users/WvL/.gem/specs/gems.github.com%80
GET http://gems.github.com/prerelease_specs.4.8.gz
301 Moved Permanently
GET http://gems.github.io/prerelease_specs.4.8.gz
404 Not Found
Exception `Gem::RemoteFetcher::FetchError' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/remote_fetcher.rb:244 - bad response Not Found 404 (http://gems.github.io/prerelease_specs.4.8.gz)
Exception `Gem::RemoteFetcher::FetchError' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/remote_fetcher.rb:274 - bad response Not Found 404 (http://gems.github.io/prerelease_specs.4.8.gz)
Exception `Errno::EEXIST' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/fileutils.rb:239 - File exists @ dir_s_mkdir - /Users/WvL/.gem/specs/gems.github.com%80
GET http://gems.github.com/specs.4.8.gz
301 Moved Permanently
GET http://gems.github.io/specs.4.8.gz
404 Not Found
Exception `Gem::RemoteFetcher::FetchError' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/remote_fetcher.rb:244 - bad response Not Found 404 (http://gems.github.io/specs.4.8.gz)
Exception `Gem::RemoteFetcher::FetchError' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/remote_fetcher.rb:274 - bad response Not Found 404 (http://gems.github.io/specs.4.8.gz)
Exception `Gem::RemoteFetcher::FetchError' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/spec_fetcher.rb:269 - bad response Not Found 404 (http://gems.github.io/specs.4.8.gz)
GET https://rubygems.org?gems=bundler
200 OK
Exception `TypeError' at /Users/WvL/.rvm/rubies/ruby-2.6.0/lib/ruby/site_ruby/2.6.0/rubygems/resolver/api_set.rb:118 - incompatible marshal file format (can't be read)
    format version 4.8 required; 60.33 given
ERROR:  While executing gem ... (TypeError)
    incompatible marshal file format (can't be read)
    format version 4.8 required; 60.33 given

Having a similar issue with rbenv

$ gem install bundler --backtrace --debug --verbose
NOTE:  Debugging mode prints all exceptions even when rescued
Exception `LoadError' at /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/resolv.rb:170 - LoadError
HEAD http://gems.rubyforge.org/api/v1/dependencies
301 Moved Permanently
HEAD https://rubygems.org
200 OK
GET https://rubygems.org?gems=bundler
200 OK
Exception `TypeError' at /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/api_set.rb:118 - incompatible marshal file format (can't be read)
    format version 4.8 required; 60.33 given
ERROR:  While executing gem ... (TypeError)
    incompatible marshal file format (can't be read)
    format version 4.8 required; 60.33 given
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/api_set.rb:118:in `load'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/api_set.rb:118:in `versions'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/api_set.rb:55:in `find_all'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/composed_set.rb:55:in `block in find_all'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/composed_set.rb:54:in `map'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/composed_set.rb:54:in `find_all'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/best_set.rb:31:in `find_all'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/installer_set.rb:155:in `find_all'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/resolver/installer_set.rb:56:in `add_always_install'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/dependency_installer.rb:478:in `resolve_dependencies'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/commands/install_command.rb:201:in `install_gem'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/commands/install_command.rb:264:in `block in install_gems'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/commands/install_command.rb:258:in `each'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/commands/install_command.rb:258:in `install_gems'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/commands/install_command.rb:165:in `execute'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/command.rb:321:in `invoke_with_build_args'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/command_manager.rb:176:in `process_args'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/command_manager.rb:146:in `run'
    /Users/halil/.rbenv/versions/2.6.1/lib/ruby/2.6.0/rubygems/gem_runner.rb:59:in `run'
    /Users/halil/.rbenv/versions/2.6.1/bin/gem:21:in `<main>'

It seems bundler can't find sources for your gem.
It's probably because the remote sources are outdated. You can check your remote sources with gem env. I think the last of these old sources has now become unavailable:

  - REMOTE SOURCES:
     - http://gems.rubyforge.org/
     - http://gems.github.com

Since these are outdated, you should add https://rubygems.org as a source now to the gem env config. You can update the config with the following commands:

gem sources -r http://gems.rubyforge.org/
gem sources -r http://gems.github.com
gem sources -a https://rubygems.org/

When updated, gem sources -lshould return:

*** CURRENT SOURCES ***

https://rubygems.org/

Credits go to https://qiita.com/hidehiro98/items/bb6ed9bc109021034af0

Indeed, updating remote sources fixed it for me.

Is there any official announcement for this? And I have recently installed Ruby 2.6.1, could it be related
to it? Sorry if I missed something.

Not that I know of.

Apparently #2648 is the same issue. Not sure if these are one-off issues, or if there was an underlying change that broke something for a group of people.

Same issue I had after upgrading my hombrew version and messing around with Ruby files on Mac OS Mojave, @WvanLelyveld answer fixed my problem. Thanks

Suddenly happened to me as well. Probably because my source was still http://rubygems.org/ instead of https://rubygems.org/

Was this page helpful?
0 / 5 - 0 ratings