diff --git a/bin/vagrant b/bin/vagrant index b9ef5feee..8319fef1f 100755 --- a/bin/vagrant +++ b/bin/vagrant @@ -66,7 +66,22 @@ end # Setup our dependencies by initializing Bundler. If we're using plugins, # then also initialize the paths to the plugins. -require "bundler" +begin + require "bundler" +rescue Errno::EINVAL + # Bundler can generated the EINVAL error during initial require, which means + # nothing has yet been setup (so no access to I18n). Note that vagrant has + # failed early and copy information related to problem and possible solution. + $stderr.puts "Vagrant failed to initialize at a very early stage:\n\n" + $stderr.puts "Vagrant received an "EINVAL" error while attempting to set some" + $stderr.puts "environment variables. This is usually caused by the total size of your" + $stderr.puts "environment variables being too large. Vagrant sets a handful of" + $stderr.puts "environment variables to function and requires this to work. Please" + $stderr.puts "delete some environment variables prior to executing Vagrant to" + $stderr.puts "fix this." + exit 255 +end + begin $vagrant_bundler_runtime = Bundler.setup(:default, :plugins) rescue Bundler::GemNotFound