Tuesday, March 20, 2012

How to Fix: Psych::SyntaxError: while parsing a block mapping; expected <block end>, but found BlockMappingStart

Was getting the following error in Rails 3.1:

Psych::SyntaxError: while parsing a block mapping; expected <block end>, but found BlockMappingStart
                   parse at org/jruby/ext/psych/PsychParser.java:264
            parse_stream at /Users/myuser/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/psych.rb:148
                   parse at /Users/myuser/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/psych.rb:119
                    load at /Users/myuser/.rvm/rubies/jruby-1.6.5/lib/ruby/1.9/psych.rb:106
  database_configuration at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/railties-3.1.0/lib/rails/application/configuration.rb:100
                 Railtie at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activerecord-3.1.0/lib/active_record/railtie.rb:68
           instance_eval at org/jruby/RubyBasicObject.java:1720
            execute_hook at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:36
                 on_load at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activesupport-3.1.0/lib/active_support/lazy_load_hooks.rb:26
                 Railtie at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activerecord-3.1.0/lib/active_record/railtie.rb:67
           instance_exec at org/jruby/RubyBasicObject.java:1747
                     run at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/railties-3.1.0/lib/rails/initializable.rb:25
        run_initializers at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/railties-3.1.0/lib/rails/initializable.rb:50
                    each at org/jruby/RubyArray.java:1612
        run_initializers at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/railties-3.1.0/lib/rails/initializable.rb:49
             initialize! at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/railties-3.1.0/lib/rails/application.rb:92
                __send__ at org/jruby/RubyBasicObject.java:1688
                    send at org/jruby/RubyKernel.java:2114
          method_missing at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/railties-3.1.0/lib/rails/railtie/configurable.rb:30
                  (root) at /path/to/app/config/environment.rb:9
                 require at org/jruby/RubyKernel.java:1047
                 require at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240
         load_dependency at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223
        new_constants_in at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640
        new_constants_in at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:639
         load_dependency at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223
                 require at /Users/myuser/.rvm/gems/jruby-1.6.5@miscgemset/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240
    require_environment! at /path/to/app/config/environment.rb:78
                  (root) at /Users/myuser/.rvm/gems/jruby-1.6.5@my_gmiscgemsetemset/gems/railties-3.1.0/lib/rails/commands.rb:39
                 require at org/jruby/RubyKernel.java:1047
                  (root) at script/rails:6

This just meant that in my database.yml, I had mistakenly indented the first line of one of the database definitions. After I removed the ident, the issue went away.

No comments: