error with rubygems – marshal data too short

This was a strange thing. I had installed the rubygems by hand using the tar.gz from rubygems.org. I use version 1.3.1 currently. It worked fine at first, so I installed all the gems I needed, like rails etc.

When I wanted to install some more gems today, all I got to see was:

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

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

I searched for a solution on google and found forums for ruby etc. Unfortunately none of these posts offered a solution to the problem – at least none, that was specific to my situation. It seems as though, this problem (mashal data too short) can occur in a lot of places, especially in databases and such. Must a an index of some kind.

Anyway, my fix was to delete everything in the ~/.gems diretory. That sets back your entire install of rubygems, because this holds information on what gems are installed an so on. But afterwards at least the “gem” command worked again. 😉

I just reinstalled all my gems. You can get a list of all installed gems with

gem list –local

This command actually worked before – thank god. 😉

All right – so much for now. Just a short incident-report. 😉

6 thoughts on “error with rubygems – marshal data too short

  1. You seemed to have the only post that touched on this issue!

    I found the problem in rubygems, and submitted a bug report for it. Looks like Eric quickly patched it, so we shouldn’t see this anymore:
    http://rubyforge.org/tracker/?func=detail&atid=575&aid=24961&group_id=126

    Thanks !

  2. Thanks for that, fixed the problem for me too.

  3. […] bruising my head against nearby objects for a while, I found a small reference on a blog about gems in ~/.gem. After wiping them out, everything worked great! In the process, I blew away […]

  4. Hi

    I had the same problem, I’m on WindowsXp which is on VirtualBox on Ubuntu(Lucid).

    In fact i had this error when i ran gem in a cmd. But I didn’t have it when lanched it directly with the RubyGems PackageManager. For me no need to delete ~/.gem

    Just for the record

    Bye

  5. Thanks a lot!
    I had the same problem and you saved me!

Leave a reply to Dylan Cancel reply