Thursday, March 31, 2011

marshal data too short - rubygems error

Today while doing "bundle update" my server started to throw weird error.

Somehow I was not able to relate it to bundler and doing

# gem update
updating installed gems
ERROR: While executing gem … (ArgumentError)
marshal data too short

explained that gem specs on the server is corrupted. I still need to figure out the reason why that happened in first place.

This error kept popping up – no matter what commands I wanted to run with rubygems (update, update –system, install…)

Googling did not give any solution on this topic. I had a feeling it is messing with ~/.gems directory - and found out to be true.
I deleted all entries inside the ~/.gems directory. I had to just just reinstall all my gems.

Any better ways to solve this problem ?


lanej said...

I'm having the same problem. what does your Gemfile look like?

lanej said...

found out specifically the dm-types.rz in the ~/.gems/specs folder was corrupt. wiped out the ~/.gems/specs folder and reran bundle install and it worked.