title: How can I fix Rails error: URI::InvalidURIError: the scheme redis does not accept registry part: :@: (or bad hostname?)
body: <p>I'm seeing an error with a Rails rake task which is complaining about an invalid URI Scheme <code>redis://</code>.  I've checked and this is <a href="http://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml" rel="nofollow">not a valid registered URI scheme with IANA</a>.  The error complains about the <code>@</code> symbol not being a valid <code>registry part</code>.</p>
  
  <pre><code>+ bundle exec rake db:reset jasmine:ci:headless
  rake aborted!
  URI::InvalidURIError: the scheme redis does not accept registry part: :@: (or bad hostname?)
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/redis-store-1.1.3/lib/redis/factory.rb:23:in `resolve'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/redis-store-1.1.3/lib/redis/factory.rb:7:in `block in create'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/redis-store-1.1.3/lib/redis/factory.rb:6:in `each'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/redis-store-1.1.3/lib/redis/factory.rb:6:in `inject'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/redis-store-1.1.3/lib/redis/factory.rb:6:in `create'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/redis-activesupport-3.2.3/lib/active_support/cache/redis_store.rb:27:in `initialize'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/cache.rb:69:in `new'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/cache.rb:69:in `lookup_store'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/application/bootstrap.rb:54:in `block (2 levels) in &lt;module:Bootstrap&gt;'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/core_ext/kernel/reporting.rb:13:in `block in silence_warnings'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/core_ext/kernel/reporting.rb:24:in `with_warnings'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/core_ext/kernel/reporting.rb:13:in `silence_warnings'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/application/bootstrap.rb:54:in `block in &lt;module:Bootstrap&gt;'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/initializable.rb:30:in `instance_exec'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/initializable.rb:30:in `run'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/initializable.rb:55:in `block in run_initializers'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/initializable.rb:54:in `each'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/initializable.rb:54:in `run_initializers'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/application.rb:136:in `initialize!'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/railtie/configurable.rb:30:in `method_missing'
  /home/jenkins/workspace/verify_refspec_jasmine/config/environment.rb:5:in `&lt;top (required)&gt;'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `block in require'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:236:in `load_dependency'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.17/lib/active_support/dependencies.rb:251:in `require'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/application.rb:103:in `require_environment!'
  /home/jenkins/workspace/verify_refspec_jasmine/vendor/bundle/ruby/1.9.1/gems/railties-3.2.17/lib/rails/application.rb:305:in `block (2 levels) in initialize_tasks'
  Tasks: TOP =&gt; db:reset =&gt; environment
  (See full trace by running task with --trace)
  Shutdown completed cleanly
  Build step 'Execute shell' marked build as failure
  Finished: FAILURE
  </code></pre>
  
  <p>The application seems to have defined URIs to connect to a Redis server in the following formats:</p>
  
  <pre><code>$ cd /path/to/mystery/app
  $ ack --ignore-dir=vendor 'redis://'
  
  config/application.rb
  45:    config.cache_store = :redis_store, "redis://:#{configatron.redis.password}@#{configatron.redis.host}:#{configatron.redis.port}/0/cache"
  
  config/initializers/sidekiq.rb
  2:url =  "redis://"
  
  config/initializers/session_store.rb
  11:  opts[:redis_server] = "redis://redistogo:#{REDIS_SERVER.client.password}@#{REDIS_SERVER.client.host}:#{REDIS_SERVER.client.port}/#{db}"
  13:  opts[:redis_server] = "redis://#{REDIS_SERVER.client.host}:#{REDIS_SERVER.client.port}/#{db}"
  </code></pre>
  
  <p>I'm pretty sure that these rake tasks worked before, so nothing I know of that should cause this error has changed.</p>
  
  <p>How does the URI class validate scheme URIs?</p>