Valid types are [:development, :runtime], not nil #592

mperham opened this Issue Aug 19, 2010 · 22 comments


None yet
mperham commented Aug 19, 2010

When I try to start my rails 3.0rc app:

    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/dependency.rb:52:in `initialize': Valid types are [:development, :runtime], not nil (ArgumentError)
from /Users/mike/.rvm/gems/ruby-1.9.2-p0@foundation/gems/bundler-1.0.0.rc.5/lib/bundler/resolver.rb:355:in `new'
from /Users/mike/.rvm/gems/ruby-1.9.2-p0@foundation/gems/bundler-1.0.0.rc.5/lib/bundler/resolver.rb:355:in `search'
from /Users/mike/.rvm/gems/ruby-1.9.2-p0@foundation/gems/bundler-1.0.0.rc.5/lib/bundler/resolver.rb:181:in `resolve'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/source_index.rb:95:in `sort_by'

Note the rubygems code is running from 1.8 while I'm trying to use 1.9.2 from RVM!?


source :rubygems

gem 'rails'
gem 'devise', :git => 'git://'
gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'capistrano'
gem 'capistrano-ext'
gem 'memcache-client'
gem 'mysql2'

gem 'admin_data', :git => 'git://', :branch => 'rails3_gem'
gem 'will_paginate', :git => 'git://', :branch => 'rails3'

gem 'rack-bug', :require => 'rack/bug', :git => 'git://', :branch => 'rails3'

group :test do
  gem 'factory_girl_rails'
  gem "rspec-rails", ">= 2.0.0.beta.19"
  gem "steak", '0.4.0.beta.1'
  gem 'vcr'
  gem "capybara"
  gem "launchy"
  gem 'mocha'
  gem 'less'

I have the exact same issue.


Same here. If i edit line 355 of lib/bundler/resolver.rb and remove the splat *, it seems to work.
ie- Change
d =, *[dep.requirement.as_list, base.first.version].flatten)

d =, [dep.requirement.as_list, base.first.version].flatten)

If i can actually get the bundler specs to run on my machine, i'll see if this breaks anything else and submit a patch


Here's my commit which seems to have resolved the issue for me. Pull request sent.

antw commented Aug 22, 2010

I just encountered the same issue while setting up Bundler with a Sinatra app; I ran rackup and received the error mentioned above.

It turns out that after installing rack the new rackup executable hadn't been picked up by the terminal. Running rackup would instead try to run the version included with OS X, which in turn loaded the wrong version of RubyGems. Opening a new terminal solved the problem.

My $LOAD_PATH, before and after:

heisee commented Aug 23, 2010


another temporary workaround is to delete Gemfile.lock every time the server starts up. Therefor I simply put

require "fileutils"


at the beginning of config/preinitializer.rb of my Rails 2.3.8 app.
I can also confirm that the patch of ajwalters seems to work in my case (instead of deleting the file)


QuBiT commented Aug 23, 2010

I had the same problem (3.0.0.rc, ruby 1.8.7)

Valid types are [:development, :runtime], not nil

solved it by installing ajwalters's bundler version (until this is solved) and applying the patch.


Had the same problem, solved by ajwalters's patch.


Just an update, when updating to Rails 3 rc2, I couldn't run bundle update rails. It would fail out (maybe because of my patch, who knows). But I uninstalled my patched version of bundler, installed bundler rc6, and was able to update everything fine. I'm also not receiving the issue described in this ticket anymore when i do rails * commands. Thought it would be beneficial for others to know. Living on the edge is fun... :-)

QuBiT commented Aug 27, 2010

I can confirm that using 1.0.0.rc.6 and rails 3.0.0.rc2 the issue is gone.


I'm not using Rails at all; I'm using Capistrano and calling bundle/setup at the start of a Capfile.

However, I just went to try and replicate my problem so that I could argue that we still need to fix this bug. And, um, I can't replicate the problem today. So, problem miraculously solved? ;)

bjeanes commented Aug 30, 2010

I can confirm that this is still occurring in Bundler 1.0.0 final. I have tested it in a rails 2.3.8 app and a rails 3.0.0.rc.2 (haven't tested final) on ruby-1.8.7-p249 with RVM --head. It occurs both in ZSH and Bash and the fix has been applied to no effect.

bjeanes commented Aug 30, 2010

Interesting ...

The cause for me was that my RVM ruby's rake executable file was hardcoded to use the system ruby:

$ head /Users/bjeanes/.rvm/gems/ruby-1.8.7-p249@test_project/bin/rake
# This file was generated by RubyGems.
# The application 'rake' is installed as part of a gem, and
# this file is here to facilitate running it.

require 'rubygems'

Sounds like you were bitten by a bug in an old version of RVM. You can read more about how it was found and fixed on Yehuda's blog:

QuBiT commented Aug 30, 2010

one remark:

i had the problem WITHOUT rvm (using passenger and ruby 1.8.7 and rails 3.0.0.rc) (see above)


@QuBiT, yes, it seems like this was actually two different bugs, but they both seem resolved now, so yay.

joel1di1 commented Oct 1, 2010

@indirect : thanks, I had the same problem and a 'rvm update' solved it :D

skippy commented Apr 28, 2011

I'm seeing this issue on a unix box with the following:
$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2011.03

$ bundle -v
Bundler version 1.0.12

gem -v


sgerrand commented Jul 6, 2011

Same issue here on Linux.

$ ruby -v
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2011.02

$ bundle -v
Bundler version 1.0.15

$ gem -v

gravis commented Jul 13, 2011

Still having this issue, but only when using tmux+vim (don't know why yet, vim without tmux is fine).

ruby -v 
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.8.0] 

bundle -v
Bundler version 1.0.15 

gem -v 

rvm -v
rvm 1.6.22 by Wayne E. Seguin ( [] 

Actually, the issue I had was related to the path environment variable. Precedence had to be set to the path where the Ruby version was used is installed.


Where is the solution?

santuxus commented Dec 5, 2011

I had the same error - in my case it was related to rubygems version...

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment