nish
nish

Reputation: 7280

`inflate': buffer error (Zlib::BufError) on doing `bundle install`

I am trying to do a bundle install, but I'm getting the following error:

Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/util.rb:40:in `inflate': buffer error (Zlib::BufError)
    from /home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems/util.rb:40:in `inflate'
    from /home/nish/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/site_ruby/1.9.1/rubygems.rb:536:in `inflate'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/fetcher.rb:93:in `fetch_spec'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/remote_specification.rb:46:in `_remote_specification'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/remote_specification.rb:51:in `method_missing'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:95:in `block (2 levels) in unmet_dependency_names'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:94:in `map'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:94:in `block in unmet_dependency_names'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:93:in `map'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:93:in `unmet_dependency_names'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:240:in `remote_specs'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:163:in `fetch_specs'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/source/rubygems.rb:67:in `specs'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:192:in `block (2 levels) in index'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `each'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:189:in `block in index'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/index.rb:9:in `build'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:185:in `index'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:179:in `resolve'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:114:in `specs'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/definition.rb:109:in `resolve_remotely!'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/installer.rb:83:in `run'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/installer.rb:14:in `install'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/cli.rb:247:in `install'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/task.rb:27:in `run'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/vendor/thor.rb:344:in `dispatch'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/vendor/thor/base.rb:434:in `start'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/bin/bundle:20:in `block in <top (required)>'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.3.5/bin/bundle:20:in `<top (required)>'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/bin/bundle:23:in `load'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@global/bin/bundle:23:in `<main>'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@voylla/bin/ruby_noexec_wrapper:14:in `eval'
    from /home/nish/.rvm/gems/ruby-1.9.2-p320@voylla/bin/ruby_noexec_wrapper:14:in `<main>'

I tried the following:

gem update --sysytem

But still I'm getting the same error. Please can someone help!. Thanks

Upvotes: 1

Views: 1712

Answers (1)

User128848244
User128848244

Reputation: 3480

SOLUTION

Found out what is causing the problem. In the case we are are using geminabox and the for what ever reason the railties-4.1.6.gemspec.rz was corrupted. Don't know how it happened but it was. So what we did was removed the railties-4.1.6

rm shared/gems/proxy/quick/Marshal.4.8/railties-4.1.6.gemspec.rz

after that the system bundled like normal. If you are having the same problem you are going to have to find a way to watch the network calls and see which one of the GET events it is stopping on.

EXTRA READING does not fix bug only suppresses it in some cases

The reason this worked was because the new version used a different version of railties by happen chance. It only gave the impression that this fixed the problem.

Here is some extra info on this bug. But it doesn't total explain why this is happening. cannot install ruby gems - zlib error

Now they have removed or fixed this code in the v2.0.0-p451 but the ruby-2.1.0 has yet to merge the patches I have yet to go back threw all the code and check each and every version but here is how you can check.

What you are looking for is this file. lib/rubygems/util.rb in there is a method called inflate this method is responsible for unzipping the gem file. However there is some sort of bug with it where it is being called on things that can't be unzipped.

This is a stable version and you wont find lib/rubygems/util.rb v2.0.0-p481. So this is difficult to find but by looking at the source code you can figure out which ones have this bug and which ones don't.

If you are using rvm use this commands to install the correct version

rvm install ruby-2.0.0-p481

To see all know ruby version avaliable you can run this command below.

$ rvm list known

[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p547]
[ruby-]2.0.0-p451
[ruby-]2.0.0[-p481]
[ruby-]2.1.1
[ruby-]2.1[.2]
[ruby-]2.1-head
ruby-head
...

By changing to that patch version you will should be ok. I have also found this bug using ruby-2.0.0-p247 as well.

The above code would suggest that you have the bug as well. However it is strange because the github repo says that it was not introduced until Nov 18, 2013.

https://github.com/ruby/ruby/commit/a7fa4d5d9aab150ad4b0c3f3217fe444df69f527.

Anyway I know there is a lot of information here but this bug is tricky. It seams to only effect some version of ruby but because of organization of the code it is hard to tell some times if it is in your version. Best way is to just check to see if you have the util.rb file and if you do then change versions.

Upvotes: 2

Related Questions