[Ruby] Unknown alias: default_settings (Failed to read or parse configuration file)

I’m following all the steps in the Ruby setup guide, however I keep getting the error below:

snackdial_1  | ** [NewRelic] FATAL : Failed to read or parse configuration file at config/newrelic.yml
snackdial_1  | ** [NewRelic] FATAL : Unknown alias: default_settings

The first line in my configuration file is common: &default_settings.

I’m using Ruby 3 and Rails 6 with Docker (docker-compose).

I have the gem 'newrelic_rpm' in my Gemfile and it is installed through bundler. I’ve ran my config file through a linter and it passed.

Any help or guidance would be much appreciated here, I can’t find much on the web for it.

I have another Rails 5 app and it doesn’t give me this issue.

Hi, @kenny14: You might try the troubleshooting steps here, especially step 6:

Hi @kenny14

That’s definitely an interesting one we actually don’t appear to have any existing ticket in our support system that match that exact error either. Aside from the stuff Phil already mentioned you might also try setting up a simple ruby app outside of a docker container and then changing the app name in your .yml file. From there you could see if the yml file works ok outside of your Docker environment and if it does you would at least know the yml file itself is good which would most likely point to an issue with the docker config at that point…

Running into the exact same issue when upgrading an application to Ruby 3.1
All Rails commands now fail because somehow this gem is unable to parse its configuration file, which worked fine before.

Hi @arne.deherdt

Thanks for reaching out here, I hope you are well.

Can you confirm if you followed the guidance shared by @philweber, Ruby Troubleshooting Framework Configuration.

If this didnt help please can you confirm with more context the issue, any screenshots or permalinks that may help us get to the root of the issue.

Hi @arne.deherdt were you able to resolve the issue and if so, how? Are you also using Docker?

I ran into this same issue after upgrading Ruby from 3.0.x to 3.1.x:

** [NewRelic] FATAL : Failed to read or parse configuration file at config/newrelic.yml
** [NewRelic] FATAL : Unknown alias: default_settings

I’ve double-checked that the Yaml file is valid and parses.

I believe it’s due to Ruby 3.1 shipping a new version of Psych (a yaml library). Ruby 3.0 ships with v3, and 3.1 ships with v4, which introduces some backwards-incompatible changes around loading yaml files.

I found a couple of workarounds but the simplest one for me was to downgrade to Psych v3 again, so I now have this in my Gemfile:

gem 'psych', '< 4'

I believe a proper fix will need to be made in the Newrelic Ruby agent itself.

Turns out I had a pretty old version of newrelic_rpm installed. Upgrading to version 8 fixed the issue for me, note this item in the Changelog:


  • Bugfix: Psych 4.0 causes errors when loading newrelic.yml

    Psych 4.0 now uses safe load behavior when using YAML.load which by default doesn’t allow aliases, causing errors when the agent loads the config file. We have updated how we load the config file to avoid these errors.


Specifying version 8.0.0 worked for me, thanks @zofrex !!

gem 'newrelic_rpm', "~> 8.0.0"