CircleCI builds fail on rake db:create

I have a project that I cannot get to build on CircleCI. All tests pass locally. If the build fails, and I rerun the build with ssh, I can connect and run all of the commands successfully, and all tests pass in the ssh session.

The build is failing at bundle exec rake db:create

I’ve tried rearranging my require statements in config/application.rb to no avail. Any ideas?

Here is the full backtrace:

#!/bin/bash -eo pipefail
bundle exec rake db:create --trace
rake aborted!
/usr/local/lib/ruby/2.4.0/uri.rb:99: warning: already initialized constant URI::VERSION_CODE
/usr/local/lib/ruby/2.4.0/uri.rb:99: warning: previous definition of VERSION_CODE was here
/usr/local/lib/ruby/2.4.0/uri.rb:100: warning: already initialized constant URI::VERSION
/usr/local/lib/ruby/2.4.0/uri.rb:100: warning: previous definition of VERSION was here
NameError: uninitialized constant URI::Generic
Did you mean?  URI::Generic
/usr/local/lib/ruby/2.4.0/uri/ftp.rb:23:in `<module:URI>'
/usr/local/lib/ruby/2.4.0/uri/ftp.rb:13:in `<top (required)>'
/usr/local/lib/ruby/2.4.0/uri.rb:107:in `require'
/usr/local/lib/ruby/2.4.0/uri.rb:107:in `<top (required)>'
/usr/local/lib/ruby/2.4.0/uri/rfc2396_parser.rb:13:in `require'
/usr/local/lib/ruby/2.4.0/uri/rfc2396_parser.rb:13:in `<top (required)>'
/usr/local/lib/ruby/2.4.0/uri/common.rb:13:in `require'
/usr/local/lib/ruby/2.4.0/uri/common.rb:13:in `<top (required)>'
/usr/local/lib/ruby/2.4.0/uri/generic.rb:12:in `require'
/usr/local/lib/ruby/2.4.0/uri/generic.rb:12:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/core_ext/object/json.rb:6:in `require'
/usr/local/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/core_ext/object/json.rb:6:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/core_ext/object.rb:13:in `require'
/usr/local/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/core_ext/object.rb:13:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails/configuration.rb:4:in `require'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails/configuration.rb:4:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails/railtie/configuration.rb:3:in `require'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails/railtie/configuration.rb:3:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails/railtie.rb:223:in `require'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails/railtie.rb:223:in `config'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails/railtie.rb:127:in `config'
/usr/local/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/i18n_railtie.rb:11:in `<class:Railtie>'
/usr/local/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/i18n_railtie.rb:10:in `<module:I18n>'
/usr/local/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/i18n_railtie.rb:9:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/railtie.rb:4:in `require'
/usr/local/bundle/ruby/2.4.0/gems/activesupport-5.2.4.1/lib/active_support/railtie.rb:4:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails.rb:17:in `require'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails.rb:17:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails/all.rb:3:in `require'
/usr/local/bundle/ruby/2.4.0/gems/railties-5.2.4.1/lib/rails/all.rb:3:in `<top (required)>'
/home/circleci/vce/config/application.rb:7:in `require'
/home/circleci/vce/config/application.rb:7:in `<top (required)>'
/home/circleci/vce/Rakefile:4:in `require'
/home/circleci/vce/Rakefile:4:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/lib/rake/rake_module.rb:28:in `load_rakefile'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/lib/rake/application.rb:689:in `raw_load_rakefile'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/lib/rake/application.rb:94:in `block in load_rakefile'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/lib/rake/application.rb:93:in `load_rakefile'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/lib/rake/application.rb:77:in `block in run'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/usr/local/bundle/ruby/2.4.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/usr/local/bundle/ruby/2.4.0/bin/rake:23:in `load'
/usr/local/bundle/ruby/2.4.0/bin/rake:23:in `<top (required)>'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `load'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/cli.rb:476:in `exec'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/cli.rb:24:in `start'
/usr/local/bundle/gems/bundler-2.1.4/exe/bundle:46:in `block in <top (required)>'
/usr/local/bundle/gems/bundler-2.1.4/lib/bundler/friendly_errors.rb:123:in `with_friendly_errors'
/usr/local/bundle/gems/bundler-2.1.4/exe/bundle:34:in `<top (required)>'
/usr/local/bundle/bin/bundle:113:in `load'
/usr/local/bundle/bin/bundle:113:in `<main>'

Exited with code exit status 1
CircleCI received exit code 1

Aggrh! Took me a lot of time to register in this site to post this answer.

OK, So I hit the same issue with Travis, another CI service provider. Turns out it was due to the version of bundler I was using. So I updated Bundler to v 2.1.4 and it started failing, when I downgraded to (ran)
bundle _2.0.2_ install it worked again.

So check your bundler version.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.