Abhijith Ravindran
Abhijith Ravindran

Reputation: 521

Rails: Frozen Error when trying to run rails application

I am running a rails application and when it now shows the below error in console and web application is not loading.

FrozenError (can't modify frozen fatal):

Please help as I don't even understand what this is. Will provide any further code details if mentioned.

Upvotes: 5

Views: 2114

Answers (4)

If anyone still struggling with that error, perhaps could be the name of you file

Example:

# filename my_api_class.rb -> bad should be my_a_p_i_class.rb

class MyAPIClass

to

# filename my_api_class.rb

class MyApiClass

Upvotes: 0

Lakhani Aliraza
Lakhani Aliraza

Reputation: 477

For me, it occurred when I tried to find resource.class after running build_resource,

To solve this I removed .class from the resource object

Upvotes: 1

PAB
PAB

Reputation: 51

I got the same error when upgrading a Rails app from 4.2.10 to 5.0. The error only happened with wicked_pdf 2.0.1, a downgrade to wicked_pdf 1.4.0 also made the trick.

Upvotes: 5

Abhijith Ravindran
Abhijith Ravindran

Reputation: 521

Finally, I found the reason. I will explain here the way which I found the solution for the issue so that it may help others who encounter the same error.

I saw the FrozenError class documentation and found that this was introduced in ruby 2.5.x and later. This is the document FrozenError Doc . I just first upgraded ruby version to latest 2.6.x but this didn't solve the issue.

Fix:

  • Downgraded the ruby version below 2.5.x to 2.4.x.
  • Now in 2.4.x, this FrozenError class does not exist.
  • I could now see the real error that caused the issue. It was a SystemStackError.
  • It was caused due a gem in project (wicked_pdf).
  • Removing the gem solved my issue.

Upvotes: 3

Related Questions