Unexpected error while processing request: invalid byte sequence in UTF-8 # - ruby-on-rails

when enable rack-mini-profiler gem, it gives error
Unexpected error while processing request: invalid byte sequence in UTF-8
using
Rails v4.0.6
rack-mini-profiler 0.10.1
Ruby 2.2.0
only happen if enable rake-mini-profiler, otherwise application working fine.
backtrace:
Unexpected error while processing request: invalid byte sequence in UTF-8
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-mini-profiler-0.10.1/lib/mini_profiler/client_settings.rb:24:in `split'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-mini-profiler-0.10.1/lib/mini_profiler/client_settings.rb:24:in `initialize'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-mini-profiler-0.10.1/lib/mini_profiler/profiler.rb:153:in `new'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-mini-profiler-0.10.1/lib/mini_profiler/profiler.rb:153:in `call'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/engine.rb:511:in `call'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/application.rb:97:in `call'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/content_length.rb:14:in `call'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:86:in `block in pre_process'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:84:in `catch'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:84:in `pre_process'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:53:in `process'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/connection.rb:39:in `receive_data'
/home/aa/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.8/lib/eventmachine.rb:193:in `run_machine'
/home/aa/.rvm/gems/ruby-2.2.0/gems/eventmachine-1.0.8/lib/eventmachine.rb:193:in `run'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/backends/base.rb:73:in `start'
/home/aa/.rvm/gems/ruby-2.2.0/gems/thin-1.6.4/lib/thin/server.rb:162:in `start'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/handler/thin.rb:16:in `run'
/home/aa/.rvm/gems/ruby-2.2.0/gems/rack-1.5.5/lib/rack/server.rb:264:in `start'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/commands/server.rb:84:in `start'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/commands.rb:76:in `block in <top (required)>'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/commands.rb:71:in `tap'
/home/aa/.rvm/gems/ruby-2.2.0/gems/railties-4.0.6/lib/rails/commands.rb:71:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
I'm not sure, i think this error keep coming after 'Slim-Rails' gem

just added
gem "handle_invalid_percent_encoding_requests"
working fine !
solution from https://stackoverflow.com/a/24894410/3212137

Related

Rails Console won't run (console error)

I'd like to run rails console command but it throw error everytime I run it.
Here is the error I get :
Loading development environment (Rails 5.1.4)
D:/RailsInstaller/Ruby2.3.3/lib/ruby/site_ruby/2.3.0/rbreadline.rb:6090:in `delete': invalid byte sequence in UTF-8 (ArgumentErr
or)
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/site_ruby/2.3.0/rbreadline.rb:6090:in `alloc_history_entry'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/site_ruby/2.3.0/rbreadline.rb:6123:in `add_history'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/site_ruby/2.3.0/readline.rb:368:in `<<'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:76:in `block (2 levels) in load_history'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:76:in `each'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:76:in `block in load_history'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:75:in `open'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:75:in `load_history'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:65:in `extended'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:21:in `extend'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:21:in `init_save_history'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/ext/save-history.rb:45:in `save_history='
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb/context.rb:91:in `initialize'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb.rb:426:in `new'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb.rb:426:in `initialize'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb.rb:383:in `new'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/2.3.0/irb.rb:383:in `start'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:6
2:in `start'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:1
7:in `start'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/console/console_command.rb:9
7:in `perform'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
from D:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I've tried to reinstall/reinstall and clean every version of ruby with no success. I use Ruby 2.3.3 and rails 5.1.4.
Thanks
Since you are on Windows(I'm assuming since you have D:/):
Try installing rb-readline gem in your development group. That's the easiest way for solving readline issues.
There are other solutions as well if that doesn't work.

Websocket Rails deadlocking issue

Having an issue in a Rails 4 app where I'm getting a deadlock error (details below). I'm using the 'websocket-rails' gem.
It seems to be happening on every 2nd request, coming from dispatcher = new WebSocketRails('localhost:3000/websocket'); (from the front-end of my app)
I've seen little to no mention of this issue except for an older issue within the faye repo on github: https://github.com/faye/faye/issues/190
Error:
Started GET "/websocket" for 127.0.0.1 at 2014-10-20 00:26:38 -0700
#<ActionDispatch::Request:0x007fae697e4a18>
Unexpected error while processing request: deadlock; recursive locking
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:16:in `lock'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:16:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/actionpack-4.1.6/lib/action_dispatch/middleware/static.rb:64:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/engine.rb:514:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/application.rb:144:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:53:in `process'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/faye-websocket-0.7.5/lib/faye/adapters/thin.rb:40:in `process'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/connection.rb:39:in `receive_data'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/faye-websocket-0.7.5/lib/faye/adapters/thin.rb:44:in `receive_data'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/backends/base.rb:73:in `start'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/thin-1.6.3/lib/thin/server.rb:162:in `start'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/server.rb:69:in `start'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:81:in `block in server'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `tap'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:76:in `server'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/railties-4.1.6/lib/rails/commands.rb:17:in `<top (required)>'
/Users/userme/Desktop/rdio-client-v2/server/bin/rails:8:in `require'
/Users/userme/Desktop/rdio-client-v2/server/bin/rails:8:in `<top (required)>'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `load'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/client/rails.rb:27:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/client/command.rb:7:in `call'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/client.rb:26:in `run'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/bin/spring:48:in `<top (required)>'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `load'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/spring-1.1.3/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/userme/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/userme/Desktop/rdio-client-v2/server/bin/spring:16:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Adding
config.middleware.delete Rack::Lock
to application.rb should help.

Rails 4.1 secrets.yml error

Just upgraded to Rails 4.1 and am using secrets.yml.
This is what it looks like:
development:
secret_key_base: akshdakjshdgakjhsdgakjdhgaskjdhgaskjdhgska
test:
secret_key_base: somelegitlongasskeygeneratedbyrakesecrethere
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
When I restart my server and visit any page, in my browser I get an "Internal Server Error".
In my log file, I see this:
$ rails s
=> Booting Thin
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
Thin web server (v1.6.2 codename Doc Brown)
Maximum connections set to 1024
Listening on 0.0.0.0:3000, CTRL+C to stop
Unexpected error while processing request: (<unknown>): found character that cannot start any token while scanning for the next token at line 14 column 1
/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse'
/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:153:in `parse'
/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:129:in `load'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/safe_yaml-1.0.3/lib/safe_yaml.rb:15:in `load_with_options'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/application.rb:313:in `secrets'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/application.rb:439:in `validate_secret_key_config!'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/application.rb:195:in `env_config'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/engine.rb:510:in `call'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/application.rb:144:in `call'
/.rvm/gems/ruby-2.0.0-p353#global/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:86:in `block in pre_process'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:84:in `catch'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:84:in `pre_process'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:53:in `process'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:39:in `receive_data'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/backends/base.rb:73:in `start'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/server.rb:162:in `start'
/.rvm/gems/ruby-2.0.0-p353#global/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run'
/.rvm/gems/ruby-2.0.0-p353#global/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/server.rb:69:in `start'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in `block in server'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Unexpected error while processing request: (<unknown>): found character that cannot start any token while scanning for the next token at line 14 column 1
/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse'
/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:153:in `parse'
/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/psych.rb:129:in `load'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/safe_yaml-1.0.3/lib/safe_yaml.rb:15:in `load_with_options'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/application.rb:313:in `secrets'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/application.rb:439:in `validate_secret_key_config!'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/application.rb:195:in `env_config'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/engine.rb:510:in `call'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/application.rb:144:in `call'
/.rvm/gems/ruby-2.0.0-p353#global/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:86:in `block in pre_process'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:84:in `catch'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:84:in `pre_process'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:53:in `process'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/connection.rb:39:in `receive_data'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/backends/base.rb:73:in `start'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/thin-1.6.2/lib/thin/server.rb:162:in `start'
/.rvm/gems/ruby-2.0.0-p353#global/gems/rack-1.5.2/lib/rack/handler/thin.rb:16:in `run'
/.rvm/gems/ruby-2.0.0-p353#global/gems/rack-1.5.2/lib/rack/server.rb:264:in `start'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/server.rb:69:in `start'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:81:in `block in server'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `tap'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:76:in `server'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
/.rvm/gems/ruby-2.0.0-p353#my_project/gems/railties-4.1.0/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Any thoughts on what could be causing this?
I tried multiple iterations of the secrets.yml file, to even enclose the secret_key_base in single quotations like 'somelongasskeyhere' but that didn't work.
Update 1
So it seems the issue may be with how finnicky YAML is. I think it has something to do with the spacing & tabs I put in, but I just can't seem to get it perfect. Now I am getting another error at a different position in the line.
After re-doing some of the spaces to just use the spacebar 4 times, versus the tab - which was set at 4 spaces, I am now getting a different error:
Unexpected error while processing request: (<unknown>): found a tab character that violate intendation while scanning a plain scalar at line 13 column 3
Which references this line:
development:
secret_key_base:'86bc42f97803818b48ff88ef15d9d4df6b6b4e4e723c119967a29751de33b5687af3a57542b4a8364cb3d6b51a872ad1188b9de6f0faab578272451aa798956c'
Update 2
It definitely is something to do with my spacing, because once I copied and pasted this file - https://github.com/RailsApps/rails-devise/blob/master/config/secrets.yml - into mine and just replaced the key_base with mine, everything worked just fine.

Ruby on Rails - Invalid encoding error

SOLVED: Used rvm to install ruby 2.0.0 and rails 3. After using a newer version of ruby, this problem disappeared.
When I run $ rails server locally and try to load any of the static assets in the browser, eg "localhost:3000/assets/javascripts/main.js", I get the following error:
Internal Server Error
invalid encoding ("UTF-8//IGNORE", "BINARY")
WEBrick/1.3.1 (Ruby/1.8.7/2012-02-08) at localhost:3000
This happens on all static assets. What could be the problem here?
I'm using Mac OS X 10.7.5
Stack trace:
[2013-02-28 12:59:12] ERROR Iconv::InvalidEncoding: invalid encoding ("UTF-8//IGNORE", "BINARY")
/Library/Ruby/Gems/1.8/gems/i18n-0.6.3/lib/i18n/core_ext/string/encoding.rb:7:in `conv'
/Library/Ruby/Gems/1.8/gems/i18n-0.6.3/lib/i18n/core_ext/string/encoding.rb:7:in `force_encoding'
/Library/Ruby/Gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb:41:in `escape_glob_chars'
/Library/Ruby/Gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb:14:in `match?'
/Library/Ruby/Gems/1.8/gems/actionpack-3.2.12/lib/action_dispatch/middleware/static.rb:56:in `call'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/engine.rb:479:in `call'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/application.rb:223:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/rack/log_tailer.rb:17:in `call'
/Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/handler/webrick.rb:59:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/handler/webrick.rb:13:in `run'
/Library/Ruby/Gems/1.8/gems/rack-1.4.5/lib/rack/server.rb:268:in `start'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/commands/server.rb:70:in `start'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/commands.rb:55
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/commands.rb:50:in `tap'
/Library/Ruby/Gems/1.8/gems/railties-3.2.12/lib/rails/commands.rb:50
script/rails:6:in `require'
script/rails:6

ActionController::MethodNotAllowed after reloading routes?

I have an application where I'm dynamically loading routes by a model, and calling ActionController::Routing::Routes.reload! after creating/updating that model. The problem is that after doing this, I'm receiving the following error when I try to hit that new route:
ActionController::MethodNotAllowed
Only get, head, post, put, and delete requests are allowed.
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/recognition_optimisation.rb:65:in `recognize_path'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:384:in `recognize'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:148:in `handle_request'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi'
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in `dispatch'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:76:in `process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/rails.rb:74:in `process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/servers/mongrel.rb:64
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require'
/usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
script/server:3
What's really odd is that the request has no parameters, and the response headers are {"cookie"=>[],
"Allow"=>"GET,
HEAD,
POST,
PUT,
DELETE",
"Cache-Control"=>"no-cache"}
All this even though the request is definitely GET (according to Firebug) and according to the response GET is certainly allowed.
I'm using Rails 2.1.0 and Mongrel 1.1.5 (after googling, I noticed some have problems with older versions).
Anyone have thoughts?
Apparently this was a bug in Rails 2.1.0. Upgrading to Rails 2.2.1 fixed the problem.
Upgrading to 2.1.2 also fixes this in case you don't want to potentially break your site with 2.2.

Resources