z3cko
z3cko

Reputation: 3054

strange bundler error: tar_input.rb:49:in `initialize': not in gzip format (Zlib::GzipFile::Error) on bundle pack

i am getting a strange bundler error when running

bundle pack

with bundler 0.9.12

any ideas? (see pastie for a better formatted code: http://pastie.org/881328 )

/opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize': not in gzip format (Zlib::GzipFile::Error)
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `new'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:49:in `initialize'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:63:in `each'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:54:in `loop'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_reader.rb:54:in `each'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:32:in `initialize'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in `new'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package/tar_input.rb:17:in `open'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/package.rb:55:in `open'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:63:in `from_io'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:51:in `from_file_by_path'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:50:in `open'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/site_ruby/1.8/rubygems/format.rb:50:in `from_file_by_path'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/source.rb:115:in `specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/source.rb:114:in `each'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/source.rb:114:in `specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:32:in `from_cached_specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:23:in `application_cached_gems'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:15:in `cached_gems'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:5:in `build'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:14:in `cached_gems'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/environment.rb:15:in `index'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/index.rb:5:in `build'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/environment.rb:13:in `index'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:86:in `specs'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:130:in `details'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:119:in `write_yml_lock'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/runtime.rb:65:in `lock'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/cli.rb:89:in `lock'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/cli.rb:131:in `package'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/task.rb:33:in `send'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/task.rb:33:in `run'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/invocation.rb:109
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/invocation.rb:116:in `call'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/invocation.rb:116:in `invoke'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor.rb:137:in `start'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor/base.rb:378:in `start'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/lib/bundler/vendor/thor.rb:124:in `start'
  from /opt/ruby-enterprise-1.8.7-2010.01/lib/ruby/gems/1.8/gems/bundler-0.9.12/bin/bundle:11
  from /opt/REE/bin/bundle:19:in `load'
  from /opt/REE/bin/bundle:19

Upvotes: 19

Views: 6382

Answers (11)

Zubin
Zubin

Reputation: 9722

I ran into this problem when deploying, but didn't want to remove vendor/cache from git.

Instead, I ended up doing this:

# deploy.rb
namespace :bundle do
  desc "Removes vendor/cache when NO_GEM_CACHE=1 is set. Resolves Zlib::GzipFile::Error (not in gzip format)."
  task :remove_cache do
    run "rm -fr #{release_path}/vendor/cache" if ENV['NO_GEM_CACHE'] == '1'
  end
end
before :'bundle:install', :'bundle:remove_cache'

Whenever this error crops up simply:

cap deploy NO_GEM_CACHE=1

Upvotes: 0

olistik
olistik

Reputation: 794

I've solved this issue in a rails 3.1 app by deleting the archived gem files:

$ bundle -v
Bundler version 1.0.17
$ rm -f vendor/bundle/ruby/1.8/cache/*.gem

Upvotes: 0

T.J. Schuck
T.J. Schuck

Reputation: 3645

Allegedly, the original issue is fixed with Bundler 1.0.x, but I still had the same error message (using 1.0.3). I removed all cache folders, including in RVM directories, as outlined in the other answers here -- no dice.

It turns out you'll also get this error if Bundler can't resolve one of your sources (i.e., those returned by $ gem sources). Even if you list multiple sources, it will ping all of them, and if any source is bad, it will crash with this nondescript 'initialize': not in gzip format error.

As described in this ticket, that can be because of something like an inaccessible VPM or local network source, but I actually ran into the problem due to my company's firewall blocking rubygems.org.

Just submitting this answer as another possible solution to clear up this vague error message.

Upvotes: 7

shedd
shedd

Reputation: 4218

Even though I'm running Bundler 1.0.0, I still hit this error. bundle install didn't work, but running bundle package did.

Upvotes: 2

Aaron Gibralter
Aaron Gibralter

Reputation: 4853

All traces of this error went away when I upgraded to Bundler 1.0.x.

Upvotes: 0

Jason Weathered
Jason Weathered

Reputation: 7801

If you're using Capistrano with Bundler's require 'bundler/capistrano', the cache directory is at shared/bundle/ruby/1.8/cache.

Upvotes: 1

morgoth
morgoth

Reputation: 1451

I was having similar problem with bundle upate (bundler 1.0). I am using rvm with gemset for my application.

Solution was to remove:

~/.rvm/gems/ree-1.8.7-2010.02@gemset-name/cache

Upvotes: 21

Aaron Gibralter
Aaron Gibralter

Reputation: 4853

rm -rf vendor/cache

bundle package

bundle install

bundle lock

It's a bit annoying... I don't know why I can't do bundle install --relock

Upvotes: 1

Andrea Pavoni
Andrea Pavoni

Reputation: 5311

just happened to me with bundler 0.9.26 and rails3 beta4. launched

bundle package

now it works. but if I remove vendor/cache the problem persists.

Upvotes: 4

Jim Soho
Jim Soho

Reputation: 2048

Had the same thing, removed /bundler_gems/cache

Upvotes: 2

z3cko
z3cko

Reputation: 3054

to answer my own question:

the fix was to delete all the contents from

vendor/cache

after that it worked.

clearly a bundler bug.

Upvotes: 14

Related Questions